I use openpgpjs library for node js. I have the following code:
//encryption function
const options = {
publicKeys: openpgp.key.readArmored(this.user.publicKey).keys,
data: data //uint8array data
};
return openpgp.encrypt(options);
And decryption function below:
const privKeyObj = openpgp.key.readArmored(this.user.secretKey).keys[0];
privKeyObj.decrypt(this.user.passphrase);
const options = {
message: openpgp.message.read(data), //data is uint8array
privateKey: privKeyObj,
format: 'binary'
};
return openpgp.decrypt(options);
but I got an error when trying to decrypt: Invalid session key for decryption
In function Message.prototype.decrypt
We have a code:
const keyObj = sessionKey || this.decryptSessionKey(privateKey, password);
But when I encrypted file I used only public key where I can find a session key to decrypt?
via Haygo
No comments:
Post a Comment