I am trying to decrypt one PGP file with OpenPGP javascript library. I am getting one error on the private key decryption
TypeError: Cannot read property 'type' of null at SecretKey.decrypt
Here is my code snippet
let privateKey = (await openpgp.key.readArmored(this.pgpConfig.privateKey));
if (!privateKey.keys[0]) {
throw privateKey.err[0];
} else {
privateKey = privateKey.keys[0];
}
await privateKey.decrypt(this.pgpConfig.passphrase);
Getting error from await privateKey.decrypt(this.pgpConfig.passphrase);
line.
I tried to decrypt a file with another online tool and it seems to work fine over there. So any idea what could be the issue here.
FYI I have generated keys from Kleopatra software.