3
我试图使用OpenPgpjs对消息进行加密和签名。加密消息时出错:私钥未解密
,但我不断收到此错误“错误加密消息:私钥是不能解密”
这是我的尝试:
var openpgp = require('openpgp');
var publicKey = [].join("\n"); //This has the complete key. Removed for representation
var privateKey = [].join("\n"); //This has the complete key. Removed for representation
var publicKeys = openpgp.key.readArmored(publicKey).keys;
var privateKeys = openpgp.key.readArmored(privateKey).keys;
encryptionOptions = {
data : 'Example Test',
publicKeys : publicKeys,
privateKeys : privateKeys
};
return openpgp.encrypt(encryptionOptions).then(function(ciphertext) {
encryptedData = ciphertext.data;
console.log(ciphertext);
return encryptedData;
});