parent
a7cc71e35e
commit
b23ee190c7
4
npm-shrinkwrap.json
generated
4
npm-shrinkwrap.json
generated
|
@ -2289,8 +2289,8 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"elliptic": {
|
"elliptic": {
|
||||||
"version": "github:openpgpjs/elliptic#1beea74833b48bd5698ed079c75fd21f0eb70b1c",
|
"version": "github:openpgpjs/elliptic#6b7801573b8940a49e7b8253176ece2725841efd",
|
||||||
"from": "github:openpgpjs/elliptic#1beea74833b48bd5698ed079c75fd21f0eb70b1c",
|
"from": "github:openpgpjs/elliptic#6b7801573b8940a49e7b8253176ece2725841efd",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"bn.js": "^4.4.0",
|
"bn.js": "^4.4.0",
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
"asmcrypto.js": "github:openpgpjs/asmcrypto#6e4e407b9b8ae317925a9e677cc7b4de3e447e83",
|
"asmcrypto.js": "github:openpgpjs/asmcrypto#6e4e407b9b8ae317925a9e677cc7b4de3e447e83",
|
||||||
"bn.js": "^4.11.8",
|
"bn.js": "^4.11.8",
|
||||||
"buffer": "^5.0.8",
|
"buffer": "^5.0.8",
|
||||||
"elliptic": "github:openpgpjs/elliptic#1beea74833b48bd5698ed079c75fd21f0eb70b1c",
|
"elliptic": "github:openpgpjs/elliptic#6b7801573b8940a49e7b8253176ece2725841efd",
|
||||||
"hash.js": "^1.1.3",
|
"hash.js": "^1.1.3",
|
||||||
"pako": "^1.0.6",
|
"pako": "^1.0.6",
|
||||||
"seek-bzip": "github:openpgpjs/seek-bzip#6187fc025851d35c4e104a25ea15a10b9b8d6f7d",
|
"seek-bzip": "github:openpgpjs/seek-bzip#6187fc025851d35c4e104a25ea15a10b9b8d6f7d",
|
||||||
|
|
|
@ -69,7 +69,39 @@ describe('Brainpool Cryptography', function () {
|
||||||
'tZa9Z9Eq1OfX2n8kR7BnPnWn9qlhg/63sgNT',
|
'tZa9Z9Eq1OfX2n8kR7BnPnWn9qlhg/63sgNT',
|
||||||
'=lNCW',
|
'=lNCW',
|
||||||
'-----END PGP MESSAGE-----'
|
'-----END PGP MESSAGE-----'
|
||||||
].join('\n')
|
].join('\n'),
|
||||||
|
message_with_leading_zero_in_hash: 'test message\n277',
|
||||||
|
message_encrypted_with_leading_zero_in_hash:
|
||||||
|
`-----BEGIN PGP MESSAGE-----
|
||||||
|
Version: OpenPGP.js v4.5.5
|
||||||
|
Comment: https://openpgpjs.org
|
||||||
|
|
||||||
|
wX4DSpmSuiUYN4MSAgMERlxfWMZgb9Xdu9v5mYq1TP2QZO9lLloIIO45tn/W
|
||||||
|
3Eg5DbJfGiBvR7QUXbFY1KiILiXXYxEm1x8i0qw793NlizAdHSiZmifeBJXX
|
||||||
|
4sV1NDOaIUXVs6Aes7rhV7G3jADlDVu2N50Ti+MdGHz8rWqYt1zSwBgBo4ag
|
||||||
|
i7YemCOYIHqpa+R6lId0+BOXKUFZYCTH8J7QSZYYkH06DFvt1LOPXJHuJrX9
|
||||||
|
E++ph0fvdrZVm9kpOFv3fnn/EeDOL4chvemC0dawTLhs0rg+bin9xhGjzpl+
|
||||||
|
tbIxp3v4WG6xt9fkNwDSVC7yYMj+LeYcF+ZG1Bw5pCdMoBnJtqKLAJbqP3Ph
|
||||||
|
TRELeagBcoQblRDF03XxrjpeCbLqZFwpFQqac9T2eqDRtvi2DA+JYCJdJorO
|
||||||
|
KnthADE6hYMCSZVS9Q1IGN3TjROB5rrB/N3xItPsXuc=
|
||||||
|
=A7qX
|
||||||
|
-----END PGP MESSAGE-----`,
|
||||||
|
message_encrypted_with_leading_zero_in_hash_signed_by_elliptic_with_old_implementation:
|
||||||
|
`-----BEGIN PGP MESSAGE-----
|
||||||
|
Version: OpenPGP.js v4.6.0
|
||||||
|
Comment: https://openpgpjs.org
|
||||||
|
|
||||||
|
wX4DSpmSuiUYN4MSAgMEdWwp5tYcxcyj3G36EkQ61Xx/gVzYbgh7U54sDsl9
|
||||||
|
NKyc9gqjtEn5OQzXJ7Uteb+ojZsRy4b5cWBNQPdXJci0kTC+s98RugN7vEHe
|
||||||
|
ulmNfwICTJ7SA4OSb0WEeACG6B1yUZmwWDcPxUfotFL3BCZGxN7SwBgBm2bQ
|
||||||
|
wzRBU3SZ8xtqSCwC50PhXXmtqlDmQqJ84oTsyikH8e6zEgI78QXTf1WK530K
|
||||||
|
0W/r+OqQufWu5ZKXK9AyeDyLc577P6/CnDcjjoJOsOZm5XMcSXlJWAvsH7KJ
|
||||||
|
X/ua3tHArWaOmBYTtbfeZc3NpI5ne/gin3Gsz0llbWKG2KF4Op2/nt+Vhqa9
|
||||||
|
tkYrARUF5n9K9+TEasU4z1k898YkS5cIzFyBSGMhGDzdj7t1K93EyOxXPc84
|
||||||
|
EJ4QcD/oQ6x1M/8X/iKQCtxZP8RnlrbH7ExkNON5s5g=
|
||||||
|
=KDoL
|
||||||
|
-----END PGP MESSAGE-----`,
|
||||||
|
message_with_leading_zero_in_hash_old_elliptic_implementation: 'test message\n199',
|
||||||
},
|
},
|
||||||
juliet: {
|
juliet: {
|
||||||
id: '37e16a986b8af99e',
|
id: '37e16a986b8af99e',
|
||||||
|
@ -197,6 +229,29 @@ describe('Brainpool Cryptography', function () {
|
||||||
expect(result.signatures).to.have.length(1);
|
expect(result.signatures).to.have.length(1);
|
||||||
expect(result.signatures[0].valid).to.be.true;
|
expect(result.signatures[0].valid).to.be.true;
|
||||||
});
|
});
|
||||||
|
it('Decrypt and verify message with leading zero in hash', async function () {
|
||||||
|
const juliet = await load_priv_key('juliet');
|
||||||
|
const romeo = await load_pub_key('romeo');
|
||||||
|
const msg = await openpgp.message.readArmored(data.romeo.message_encrypted_with_leading_zero_in_hash);
|
||||||
|
const result = await openpgp.decrypt({privateKeys: juliet, publicKeys: [romeo], message: msg});
|
||||||
|
|
||||||
|
expect(result).to.exist;
|
||||||
|
expect(result.data).to.equal(data.romeo.message_with_leading_zero_in_hash);
|
||||||
|
expect(result.signatures).to.have.length(1);
|
||||||
|
expect(result.signatures[0].valid).to.be.true;
|
||||||
|
});
|
||||||
|
it('Decrypt and verify message with leading zero in hash signed with old elliptic algorithm', async function () {
|
||||||
|
const juliet = await load_priv_key('juliet');
|
||||||
|
const romeo = await load_pub_key('romeo');
|
||||||
|
const msg = await openpgp.message.readArmored(data.romeo. message_encrypted_with_leading_zero_in_hash_signed_by_elliptic_with_old_implementation);
|
||||||
|
const result = await openpgp.decrypt({privateKeys: juliet, publicKeys: [romeo], message: msg});
|
||||||
|
|
||||||
|
expect(result).to.exist;
|
||||||
|
expect(result.data).to.equal(data.romeo.message_with_leading_zero_in_hash_old_elliptic_implementation);
|
||||||
|
expect(result.signatures).to.have.length(1);
|
||||||
|
expect(result.signatures[0].valid).to.be.true;
|
||||||
|
});
|
||||||
|
|
||||||
it('Encrypt and sign message', async function () {
|
it('Encrypt and sign message', async function () {
|
||||||
const romeoPrivate = await load_priv_key('romeo');
|
const romeoPrivate = await load_priv_key('romeo');
|
||||||
const julietPublic = await load_pub_key('juliet');
|
const julietPublic = await load_pub_key('juliet');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user