mirror of
https://github.com/openpgpjs/openpgpjs.git
synced 2026-03-01 06:23:26 +00:00
Implement Symmetric-Key Message Encryption using a passphrase
See https://tools.ietf.org/html/rfc4880#section-3.7.2.2
This commit is contained in:
@@ -323,6 +323,25 @@ describe('Basic', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('Encrypt message symmetrically using passphrase', function() {
|
||||
it('should encrypt/decrypt successfully', function() {
|
||||
var passphrase = 'passphrase';
|
||||
var plaintext = 'secret stuff';
|
||||
|
||||
// encrypt
|
||||
var msg = openpgp.message.fromText(plaintext);
|
||||
msg = msg.symEncrypt(passphrase);
|
||||
var encrypted = msg.armor();
|
||||
|
||||
// decrypt
|
||||
var msg2 = openpgp.message.readArmored(encrypted);
|
||||
msg2 = msg2.symDecrypt(passphrase);
|
||||
var decrypted = msg2.getText();
|
||||
|
||||
expect(decrypted).to.equal(plaintext);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Message 3DES decryption", function() {
|
||||
var pgp_msg =
|
||||
['-----BEGIN PGP MESSAGE-----',
|
||||
|
||||
Reference in New Issue
Block a user