Lint all tests (#1235)
This commit is contained in:
parent
8f8517702e
commit
b6edfe646b
|
@ -1 +1,3 @@
|
|||
src/compression
|
||||
dist
|
||||
test/lib/
|
||||
test/typescript/definitions.js
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
"browsertest": "npm start -- -o test/unittests.html",
|
||||
"browserstack": "karma start test/karma.conf.js",
|
||||
"coverage": "nyc npm test",
|
||||
"lint": "eslint 'src/**/*.js' 'test/crypto/**/*.js'",
|
||||
"lint": "eslint .",
|
||||
"docs": "jsdoc --configure .jsdocrc.js --destination docs --recurse README.md src",
|
||||
"preversion": "rm -rf dist docs node_modules && npm install && npm test",
|
||||
"version": "npm run docs && git add -A docs",
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable no-process-env */
|
||||
|
||||
import { builtinModules } from 'module';
|
||||
|
||||
import resolve from '@rollup/plugin-node-resolve';
|
||||
|
@ -65,7 +67,7 @@ export default Object.assign([
|
|||
resolve(),
|
||||
commonjs(),
|
||||
replace({
|
||||
'OpenPGP.js VERSION': `OpenPGP.js ${pkg.version}`,
|
||||
'OpenPGP.js VERSION': `OpenPGP.js ${pkg.version}`
|
||||
})
|
||||
]
|
||||
},
|
||||
|
@ -93,7 +95,7 @@ export default Object.assign([
|
|||
{
|
||||
input: 'test/unittests.js',
|
||||
output: [
|
||||
{ file: 'test/lib/unittests-bundle.js', format: 'es', intro, sourcemap: true },
|
||||
{ file: 'test/lib/unittests-bundle.js', format: 'es', intro, sourcemap: true }
|
||||
],
|
||||
inlineDynamicImports: true,
|
||||
external: ['../..', '../../..'],
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
/* eslint-disable import/newline-after-import, import/first */
|
||||
|
||||
/**
|
||||
* Export high level API functions.
|
||||
* Usage:
|
||||
*
|
||||
* import { encrypt } from 'openpgp'
|
||||
* encrypt({ message, publicKeys })
|
||||
* import { encrypt } from 'openpgp';
|
||||
* encrypt({ message, publicKeys });
|
||||
*/
|
||||
export {
|
||||
encrypt, decrypt, sign, verify,
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/* eslint-disable callback-return */
|
||||
/**
|
||||
* @requires web-stream-tools
|
||||
* @requires packet/all_packets
|
||||
|
|
|
@ -9,21 +9,21 @@ module.exports = () => describe("ASCII armor", function() {
|
|||
function getArmor(headers, signatureHeaders) {
|
||||
return ['-----BEGIN PGP SIGNED MESSAGE-----']
|
||||
.concat(headers)
|
||||
.concat(
|
||||
['',
|
||||
.concat([
|
||||
'',
|
||||
'sign this',
|
||||
'-----BEGIN PGP SIGNATURE-----']
|
||||
)
|
||||
'-----BEGIN PGP SIGNATURE-----'
|
||||
])
|
||||
.concat(signatureHeaders || ['Version: GnuPG v2.0.22 (GNU/Linux)'])
|
||||
.concat(
|
||||
['',
|
||||
.concat([
|
||||
'',
|
||||
'iJwEAQECAAYFAlMrPj0ACgkQ4IT3RGwgLJfYkQQAgHMQieazCVdfGAfzQM69Egm5',
|
||||
'HhcQszODD898wpoGCHgiNdNo1+5nujQAtXnkcxM+Vf7onfbTvUqut/siyO3fzqhK',
|
||||
'LQ9DiQUwJMBE8nOwVR7Mpc4kLNngMTNaHAjZaVaDpTCrklPY+TPHIZnu0B6Ur+6t',
|
||||
'skTzzVXIxMYw8ihbHfk=',
|
||||
'=e/eA',
|
||||
'-----END PGP SIGNATURE-----']
|
||||
).join('\n');
|
||||
'-----END PGP SIGNATURE-----'
|
||||
]).join('\n');
|
||||
}
|
||||
|
||||
it('Parse cleartext signed message', async function () {
|
||||
|
@ -81,8 +81,8 @@ module.exports = () => describe("ASCII armor", function() {
|
|||
});
|
||||
|
||||
it('Filter whitespace in blank line', async function () {
|
||||
let msg =
|
||||
['-----BEGIN PGP SIGNED MESSAGE-----',
|
||||
let msg = [
|
||||
'-----BEGIN PGP SIGNED MESSAGE-----',
|
||||
'Hash: SHA1',
|
||||
' \f\r\t\u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000',
|
||||
'sign this',
|
||||
|
@ -94,7 +94,8 @@ module.exports = () => describe("ASCII armor", function() {
|
|||
'LQ9DiQUwJMBE8nOwVR7Mpc4kLNngMTNaHAjZaVaDpTCrklPY+TPHIZnu0B6Ur+6t',
|
||||
'skTzzVXIxMYw8ihbHfk=',
|
||||
'=e/eA',
|
||||
'-----END PGP SIGNATURE-----'].join('\n');
|
||||
'-----END PGP SIGNATURE-----'
|
||||
].join('\n');
|
||||
|
||||
msg = await openpgp.readArmoredCleartextMessage(msg);
|
||||
expect(msg).to.be.an.instanceof(openpgp.CleartextMessage);
|
||||
|
@ -127,8 +128,8 @@ module.exports = () => describe("ASCII armor", function() {
|
|||
});
|
||||
|
||||
it('Exception if wrong armor header type', async function () {
|
||||
let msg =
|
||||
['-----BEGIN PGP SIGNED MESSAGE\u2010\u2010\u2010\u2010\u2010\nHash:SHA1\n\nIs this properly-----',
|
||||
let msg = [
|
||||
'-----BEGIN PGP SIGNED MESSAGE\u2010\u2010\u2010\u2010\u2010\nHash:SHA1\n\nIs this properly-----',
|
||||
'',
|
||||
'sign this',
|
||||
'-----BEGIN PGP SIGNNATURE-----',
|
||||
|
@ -139,15 +140,16 @@ module.exports = () => describe("ASCII armor", function() {
|
|||
'LQ9DiQUwJMBE8nOwVR7Mpc4kLNngMTNaHAjZaVaDpTCrklPY+TPHIZnu0B6Ur+6t',
|
||||
'skTzzVXIxMYw8ihbHfk=',
|
||||
'=e/eA',
|
||||
'-----END PGP SIGNNATURE-----'].join('\n');
|
||||
'-----END PGP SIGNNATURE-----'
|
||||
].join('\n');
|
||||
|
||||
msg = openpgp.readArmoredCleartextMessage(msg);
|
||||
await expect(msg).to.be.rejectedWith(Error, /Unknown ASCII armor type/);
|
||||
});
|
||||
|
||||
it('Armor checksum validation - mismatch', async function () {
|
||||
const privKey =
|
||||
['-----BEGIN PGP PRIVATE KEY BLOCK-----',
|
||||
const privKey = [
|
||||
'-----BEGIN PGP PRIVATE KEY BLOCK-----',
|
||||
'Version: OpenPGP.js v0.3.0',
|
||||
'Comment: https://openpgpjs.org',
|
||||
'',
|
||||
|
@ -164,7 +166,8 @@ module.exports = () => describe("ASCII armor", function() {
|
|||
'ABMFAlLm1+4JEBD8MASZrpALAhsMAAC3IgD8DnLGbMnpLtrX72RCkPW1ffLq',
|
||||
'71vlXMJNXvoCeuejiRw=',
|
||||
'=wJN@',
|
||||
'-----END PGP PRIVATE KEY BLOCK-----'].join('\n');
|
||||
'-----END PGP PRIVATE KEY BLOCK-----'
|
||||
].join('\n');
|
||||
|
||||
// try with default config
|
||||
await expect(openpgp.readArmoredKey(privKey)).to.be.rejectedWith(/Ascii armor integrity check on message failed/);
|
||||
|
@ -289,8 +292,8 @@ module.exports = () => describe("ASCII armor", function() {
|
|||
});
|
||||
|
||||
it('Accept header with trailing whitespace', async function () {
|
||||
const privKey =
|
||||
['-----BEGIN PGP PRIVATE KEY BLOCK-----',
|
||||
const privKey = [
|
||||
'-----BEGIN PGP PRIVATE KEY BLOCK-----',
|
||||
'Version: OpenPGP.js v0.3.0',
|
||||
'Comment: https://openpgpjs.org',
|
||||
'',
|
||||
|
@ -308,7 +311,8 @@ module.exports = () => describe("ASCII armor", function() {
|
|||
'71vlXMJNXvoCeuejiRw=',
|
||||
'=wJNM',
|
||||
'-----END PGP PRIVATE KEY BLOCK-----',
|
||||
''].join('\t \r\n');
|
||||
''
|
||||
].join('\t \r\n');
|
||||
|
||||
const result = await openpgp.readArmoredKey(privKey);
|
||||
expect(result).to.be.an.instanceof(openpgp.Key);
|
||||
|
@ -321,7 +325,7 @@ module.exports = () => describe("ASCII armor", function() {
|
|||
});
|
||||
|
||||
it('Do not add extraneous blank line when base64 ends on line break', async function () {
|
||||
let pubKey = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
const pubKey = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
xsFNBFuR4MABEACoJ9e8zvhj80mFWJzxDErNnD78taGh7hJTs/H1CIIAykjf
|
||||
NEvTWcnnDI2dsK7J+dBQq9R40G5YYDUvA2dMztqq5BuaUlJvdSiQtqMcirhF
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
const openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../..');
|
||||
const random = require('../../src/crypto/random');
|
||||
const util = require('../../src/util');
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ module.exports = () => (openpgp.config.ci ? describe.skip : describe)('Brainpool
|
|||
//only x25519 crypto is fully functional in lightbuild
|
||||
if (!openpgp.config.useIndutnyElliptic && !util.getNodeCrypto()) {
|
||||
before(function() {
|
||||
this.skip();
|
||||
this.skip(); // eslint-disable-line no-invalid-this
|
||||
});
|
||||
}
|
||||
const data = {
|
||||
|
@ -38,7 +38,7 @@ module.exports = () => (openpgp.config.ci ? describe.skip : describe)('Brainpool
|
|||
'oml1QWkiI6BtbLD39Su6zQKR7u+Y',
|
||||
'=wB7z',
|
||||
'-----END PGP PUBLIC KEY BLOCK-----'
|
||||
].join('\n'),
|
||||
].join('\n'),
|
||||
priv: [
|
||||
'-----BEGIN PGP PRIVATE KEY BLOCK-----',
|
||||
'',
|
||||
|
@ -61,7 +61,7 @@ module.exports = () => (openpgp.config.ci ? describe.skip : describe)('Brainpool
|
|||
'v6i5Smbioml1QWkiI6BtbLD39Su6zQKR7u+Y',
|
||||
'=uGZP',
|
||||
'-----END PGP PRIVATE KEY BLOCK-----'
|
||||
].join('\n'),
|
||||
].join('\n'),
|
||||
message: 'test message\n',
|
||||
message_encrypted: [
|
||||
'-----BEGIN PGP MESSAGE-----',
|
||||
|
@ -108,7 +108,7 @@ tkYrARUF5n9K9+TEasU4z1k898YkS5cIzFyBSGMhGDzdj7t1K93EyOxXPc84
|
|||
EJ4QcD/oQ6x1M/8X/iKQCtxZP8RnlrbH7ExkNON5s5g=
|
||||
=KDoL
|
||||
-----END PGP MESSAGE-----`,
|
||||
message_with_leading_zero_in_hash_old_elliptic_implementation: 'test message\n199',
|
||||
message_with_leading_zero_in_hash_old_elliptic_implementation: 'test message\n199'
|
||||
},
|
||||
juliet: {
|
||||
id: '37e16a986b8af99e',
|
||||
|
@ -128,7 +128,7 @@ EJ4QcD/oQ6x1M/8X/iKQCtxZP8RnlrbH7ExkNON5s5g=
|
|||
'ziZiAP9mU1Kajp2PVmj3IPpd+Q+F/2U8H7nrRndo97c2vPqFtQ==',
|
||||
'=SwMu',
|
||||
'-----END PGP PUBLIC KEY BLOCK-----'
|
||||
].join('\n'),
|
||||
].join('\n'),
|
||||
priv: [
|
||||
'-----BEGIN PGP PRIVATE KEY BLOCK-----',
|
||||
'',
|
||||
|
@ -148,7 +148,7 @@ EJ4QcD/oQ6x1M/8X/iKQCtxZP8RnlrbH7ExkNON5s5g=
|
|||
'60Z3aPe3Nrz6hbU=',
|
||||
'=3Dct',
|
||||
'-----END PGP PRIVATE KEY BLOCK-----'
|
||||
].join('\n'),
|
||||
].join('\n'),
|
||||
message: 'second test message\n',
|
||||
message_signed: [
|
||||
'-----BEGIN PGP SIGNED MESSAGE-----',
|
||||
|
@ -165,7 +165,7 @@ EJ4QcD/oQ6x1M/8X/iKQCtxZP8RnlrbH7ExkNON5s5g=
|
|||
'upbAEX7k',
|
||||
'=obwy',
|
||||
'-----END PGP SIGNATURE-----'
|
||||
].join('\n')
|
||||
].join('\n')
|
||||
|
||||
}
|
||||
};
|
||||
|
@ -201,7 +201,7 @@ EJ4QcD/oQ6x1M/8X/iKQCtxZP8RnlrbH7ExkNON5s5g=
|
|||
it('Verify clear signed message', async function () {
|
||||
const pub = await load_pub_key('juliet');
|
||||
const msg = await openpgp.readArmoredCleartextMessage(data.juliet.message_signed);
|
||||
return openpgp.verify({publicKeys: [pub], message: msg}).then(function(result) {
|
||||
return openpgp.verify({ publicKeys: [pub], message: msg }).then(function(result) {
|
||||
expect(result).to.exist;
|
||||
expect(result.data).to.equal(data.juliet.message);
|
||||
expect(result.signatures).to.have.length(1);
|
||||
|
@ -210,10 +210,10 @@ EJ4QcD/oQ6x1M/8X/iKQCtxZP8RnlrbH7ExkNON5s5g=
|
|||
});
|
||||
it('Sign message', async function () {
|
||||
const romeoPrivate = await load_priv_key('romeo');
|
||||
const signed = await openpgp.sign({privateKeys: [romeoPrivate], message: openpgp.CleartextMessage.fromText(data.romeo.message)});
|
||||
const signed = await openpgp.sign({ privateKeys: [romeoPrivate], message: openpgp.CleartextMessage.fromText(data.romeo.message) });
|
||||
const romeoPublic = await load_pub_key('romeo');
|
||||
const msg = await openpgp.readArmoredCleartextMessage(signed);
|
||||
const result = await openpgp.verify({publicKeys: [romeoPublic], message: msg});
|
||||
const result = await openpgp.verify({ publicKeys: [romeoPublic], message: msg });
|
||||
|
||||
expect(result).to.exist;
|
||||
expect(result.data).to.equal(data.romeo.message);
|
||||
|
@ -235,7 +235,7 @@ EJ4QcD/oQ6x1M/8X/iKQCtxZP8RnlrbH7ExkNON5s5g=
|
|||
const juliet = await load_priv_key('juliet');
|
||||
const romeo = await load_pub_key('romeo');
|
||||
const msg = await openpgp.readArmoredMessage(data.romeo.message_encrypted_with_leading_zero_in_hash);
|
||||
const result = await openpgp.decrypt({privateKeys: juliet, publicKeys: [romeo], message: msg});
|
||||
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);
|
||||
|
@ -248,8 +248,8 @@ EJ4QcD/oQ6x1M/8X/iKQCtxZP8RnlrbH7ExkNON5s5g=
|
|||
openpgp.config.useNative = false;
|
||||
const juliet = await load_priv_key('juliet');
|
||||
const romeo = await load_pub_key('romeo');
|
||||
const msg = await openpgp.readArmoredMessage(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});
|
||||
const msg = await openpgp.readArmoredMessage(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 });
|
||||
openpgp.config.useNative = useNative;
|
||||
expect(result).to.exist;
|
||||
expect(result.data).to.equal(data.romeo.message_with_leading_zero_in_hash_old_elliptic_implementation);
|
||||
|
@ -260,12 +260,12 @@ EJ4QcD/oQ6x1M/8X/iKQCtxZP8RnlrbH7ExkNON5s5g=
|
|||
it('Encrypt and sign message', async function () {
|
||||
const romeoPrivate = await load_priv_key('romeo');
|
||||
const julietPublic = await load_pub_key('juliet');
|
||||
const encrypted = await openpgp.encrypt({publicKeys: [julietPublic], privateKeys: [romeoPrivate], message: openpgp.Message.fromText(data.romeo.message)});
|
||||
const encrypted = await openpgp.encrypt({ publicKeys: [julietPublic], privateKeys: [romeoPrivate], message: openpgp.Message.fromText(data.romeo.message) });
|
||||
|
||||
const message = await openpgp.readArmoredMessage(encrypted);
|
||||
const romeoPublic = await load_pub_key('romeo');
|
||||
const julietPrivate = await load_priv_key('juliet');
|
||||
const result = await openpgp.decrypt({privateKeys: julietPrivate, publicKeys: [romeoPublic], message: message});
|
||||
const result = await openpgp.decrypt({ privateKeys: julietPrivate, publicKeys: [romeoPublic], message: message });
|
||||
|
||||
expect(result).to.exist;
|
||||
expect(result.data).to.equal(data.romeo.message);
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
/* globals tryTests: true */
|
||||
|
||||
const openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../..');
|
||||
|
||||
const chai = require('chai');
|
||||
|
@ -11,7 +9,7 @@ const expect = chai.expect;
|
|||
module.exports = () => describe('Elliptic Curve Cryptography for NIST P-256,P-384,P-521 curves @lightweight', function () {
|
||||
function omnibus() {
|
||||
it('Omnibus NIST P-256 Test', function () {
|
||||
const options = { userIds: {name: "Hi", email: "hi@hel.lo"}, curve: "p256" };
|
||||
const options = { userIds: { name: "Hi", email: "hi@hel.lo" }, curve: "p256" };
|
||||
const testData = input.createSomeMessage();
|
||||
const testData2 = input.createSomeMessage();
|
||||
return openpgp.generateKey(options).then(function (firstKey) {
|
||||
|
@ -70,21 +68,21 @@ module.exports = () => describe('Elliptic Curve Cryptography for NIST P-256,P-38
|
|||
|
||||
it('Sign message', async function () {
|
||||
const testData = input.createSomeMessage();
|
||||
let options = { userIds: {name: "Hi", email: "hi@hel.lo"}, curve: "p256" };
|
||||
const options = { userIds: { name: "Hi", email: "hi@hel.lo" }, curve: "p256" };
|
||||
const firstKey = await openpgp.generateKey(options);
|
||||
const signature = await openpgp.sign({ message: openpgp.CleartextMessage.fromText(testData), privateKeys: firstKey.key });
|
||||
const signature = await openpgp.sign({ message: openpgp.CleartextMessage.fromText(testData), privateKeys: firstKey.key });
|
||||
const msg = await openpgp.readArmoredCleartextMessage(signature);
|
||||
const result = await openpgp.verify({ message: msg, publicKeys: firstKey.key.toPublic()});
|
||||
const result = await openpgp.verify({ message: msg, publicKeys: firstKey.key.toPublic() });
|
||||
expect(result.signatures[0].valid).to.be.true;
|
||||
});
|
||||
|
||||
it('encrypt and sign message', async function () {
|
||||
const testData = input.createSomeMessage();
|
||||
let options = { userIds: {name: "Hi", email: "hi@hel.lo"}, curve: "p256" };
|
||||
let options = { userIds: { name: "Hi", email: "hi@hel.lo" }, curve: "p256" };
|
||||
const firstKey = await openpgp.generateKey(options);
|
||||
options = { userIds: { name: "Bye", email: "bye@good.bye" }, curve: "p256" };
|
||||
const secondKey = await openpgp.generateKey(options);
|
||||
const encrypted = await openpgp.encrypt(
|
||||
const encrypted = await openpgp.encrypt(
|
||||
{ message: openpgp.Message.fromText(testData),
|
||||
publicKeys: [secondKey.key.toPublic()],
|
||||
privateKeys: [firstKey.key] }
|
||||
|
@ -94,7 +92,7 @@ module.exports = () => describe('Elliptic Curve Cryptography for NIST P-256,P-38
|
|||
{ message: msg,
|
||||
privateKeys: secondKey.key,
|
||||
publicKeys: [firstKey.key.toPublic()] }
|
||||
)
|
||||
);
|
||||
expect(result.signatures[0].valid).to.be.true;
|
||||
});
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
/* globals tryTests: true */
|
||||
|
||||
const openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../..');
|
||||
const util = require('../../src/util');
|
||||
|
||||
|
@ -11,7 +9,7 @@ const expect = chai.expect;
|
|||
module.exports = () => describe('Elliptic Curve Cryptography for secp256k1 curve @lightweight', function () {
|
||||
if (!openpgp.config.useIndutnyElliptic && !util.getNodeCrypto()) {
|
||||
before(function() {
|
||||
this.skip();
|
||||
this.skip(); // eslint-disable-line no-invalid-this
|
||||
});
|
||||
}
|
||||
const data = {
|
||||
|
@ -177,7 +175,7 @@ module.exports = () => describe('Elliptic Curve Cryptography for secp256k1 curve
|
|||
it('Verify clear signed message', async function () {
|
||||
const pub = await load_pub_key('juliet');
|
||||
const msg = await openpgp.readArmoredCleartextMessage(data.juliet.message_signed);
|
||||
return openpgp.verify({publicKeys: [pub], message: msg}).then(function(result) {
|
||||
return openpgp.verify({ publicKeys: [pub], message: msg }).then(function(result) {
|
||||
expect(result).to.exist;
|
||||
expect(result.data).to.equal(data.juliet.message);
|
||||
expect(result.signatures).to.have.length(1);
|
||||
|
@ -186,10 +184,10 @@ module.exports = () => describe('Elliptic Curve Cryptography for secp256k1 curve
|
|||
});
|
||||
it('Sign message', async function () {
|
||||
const romeoPrivate = await load_priv_key('romeo');
|
||||
const signed = await openpgp.sign({privateKeys: [romeoPrivate], message: openpgp.CleartextMessage.fromText(data.romeo.message)});
|
||||
const signed = await openpgp.sign({ privateKeys: [romeoPrivate], message: openpgp.CleartextMessage.fromText(data.romeo.message) });
|
||||
const romeoPublic = await load_pub_key('romeo');
|
||||
const msg = await openpgp.readArmoredCleartextMessage(signed);
|
||||
const result = await openpgp.verify({publicKeys: [romeoPublic], message: msg});
|
||||
const result = await openpgp.verify({ publicKeys: [romeoPublic], message: msg });
|
||||
|
||||
expect(result).to.exist;
|
||||
expect(result.data).to.equal(data.romeo.message);
|
||||
|
@ -200,7 +198,7 @@ module.exports = () => describe('Elliptic Curve Cryptography for secp256k1 curve
|
|||
const juliet = await load_pub_key('juliet');
|
||||
const romeo = await load_priv_key('romeo');
|
||||
const msg = await openpgp.readArmoredMessage(data.juliet.message_encrypted);
|
||||
const result = await openpgp.decrypt({privateKeys: romeo, publicKeys: [juliet], message: msg});
|
||||
const result = await openpgp.decrypt({ privateKeys: romeo, publicKeys: [juliet], message: msg });
|
||||
|
||||
expect(result).to.exist;
|
||||
expect(result.data).to.equal(data.juliet.message);
|
||||
|
@ -210,12 +208,12 @@ module.exports = () => describe('Elliptic Curve Cryptography for secp256k1 curve
|
|||
it('Encrypt and sign message', async function () {
|
||||
const romeoPrivate = await load_priv_key('romeo');
|
||||
const julietPublic = await load_pub_key('juliet');
|
||||
const encrypted = await openpgp.encrypt({publicKeys: [julietPublic], privateKeys: [romeoPrivate], message: openpgp.Message.fromText(data.romeo.message)});
|
||||
const encrypted = await openpgp.encrypt({ publicKeys: [julietPublic], privateKeys: [romeoPrivate], message: openpgp.Message.fromText(data.romeo.message) });
|
||||
|
||||
const message = await openpgp.readArmoredMessage(encrypted);
|
||||
const romeoPublic = await load_pub_key('romeo');
|
||||
const julietPrivate = await load_priv_key('juliet');
|
||||
const result = await openpgp.decrypt({privateKeys: julietPrivate, publicKeys: [romeoPublic], message: message});
|
||||
const result = await openpgp.decrypt({ privateKeys: julietPrivate, publicKeys: [romeoPublic], message: message });
|
||||
|
||||
expect(result).to.exist;
|
||||
expect(result.data).to.equal(data.romeo.message);
|
||||
|
@ -224,7 +222,7 @@ module.exports = () => describe('Elliptic Curve Cryptography for secp256k1 curve
|
|||
});
|
||||
it('Generate key', function () {
|
||||
const options = {
|
||||
userIds: {name: "Hamlet (secp256k1)", email: "hamlet@example.net"},
|
||||
userIds: { name: "Hamlet (secp256k1)", email: "hamlet@example.net" },
|
||||
curve: "secp256k1",
|
||||
passphrase: "ophelia"
|
||||
};
|
||||
|
|
|
@ -5,118 +5,118 @@ const chai = require('chai');
|
|||
const { expect } = chai;
|
||||
|
||||
module.exports = () => describe.skip('HKP unit tests', function() {
|
||||
this.timeout(60000);
|
||||
this.timeout(60000); // eslint-disable-line no-invalid-this
|
||||
|
||||
let hkp;
|
||||
|
||||
const pub_key = '-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n' +
|
||||
'Version: SKS 1.1.5\r\n' +
|
||||
'Comment: Hostname: keyserver.ubuntu.com\r\n' +
|
||||
'\r\n' +
|
||||
'mQENBFUUKBcBCACwrPNnlBKPnwPXcjIdJUREoeeZx9Zw2mHPqZ3XJxq/zW38RUQgbTmjJjJv\r\n' +
|
||||
'3vO/HtXS76lTZOkWUjbLosEzKaI91phbD1SxJd4HhbRSaFpQc4yWYPmt7F7QFSYf4zGA5BRp\r\n' +
|
||||
'yRcxyQ75RklyYfndYna42jVEbW7UA753e2iDdSn3KQTKdkL+tZegUw+9vxY75X44P31rGogK\r\n' +
|
||||
'N0mEYVWWjZ+++0uZOSO0ZKwfDf65AkI598c4Wh3qXEZvKyC75YQdDNNw7KBlTbrqok0VptS+\r\n' +
|
||||
'4wok309KPbmRf5e/alUp+/B3vxOs7I7QStpjoh8jl64LhzMGlUYvpJDtC3gytK3KN9jTABEB\r\n' +
|
||||
'AAG0KVRlc3QgVXNlciA8c2FmZXdpdGhtZS50ZXN0dXNlckBnbWFpbC5jb20+iQEyBBABCAAm\r\n' +
|
||||
'BQJVFCgXBgsJCAcDAgkQRTDnvxQqhQQEFQgCCgMWAgECGwMCHgEAAAk9CACsT8cmBhWfNdEB\r\n' +
|
||||
'jTwiCJUwnE6YzYmxMqDkkkDXThZa45g0Mh2vJPSNw+kjdb8KM1L9KrqGwyN7DbYvRhEZTCKN\r\n' +
|
||||
'1Z5Xk1DfTlqHyXbUvFedP7kO6d/tdH3e6uwSz/ZaDnV7eAO9Ixh9OfZbBweFeCo/LzKSkEUa\r\n' +
|
||||
'bKNiZd925LfGhif7FLXlNeOFlTZ3PLf4RRtvQzWZsEWl3IlBJdg8NP4EdZPjoLC//o8gMuNQ\r\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730uTZ+ekmLBRk2gdJGh/O9bXktSktRgtIylLVmlH/R24ij\r\n' +
|
||||
'CfHViQ1VxWhg7Db9YxeTpu9p0sl4EtkmfK4YczJ3H5Q+fAv8HuM9iOeWXUqxIYhdXb2e0uVd\r\n' +
|
||||
'nUxxgC1OTbUFYBTI5D+VoJFIA3/i6OBeEGrrfg7ufB3xYdUoSVtZQq756/jmd7ffh1oGz5Di\r\n' +
|
||||
'uw9LVuvHh8RGCH2NZY48zdfB\r\n' +
|
||||
'=5obP\r\n' +
|
||||
'-----END PGP PUBLIC KEY BLOCK-----';
|
||||
'Version: SKS 1.1.5\r\n' +
|
||||
'Comment: Hostname: keyserver.ubuntu.com\r\n' +
|
||||
'\r\n' +
|
||||
'mQENBFUUKBcBCACwrPNnlBKPnwPXcjIdJUREoeeZx9Zw2mHPqZ3XJxq/zW38RUQgbTmjJjJv\r\n' +
|
||||
'3vO/HtXS76lTZOkWUjbLosEzKaI91phbD1SxJd4HhbRSaFpQc4yWYPmt7F7QFSYf4zGA5BRp\r\n' +
|
||||
'yRcxyQ75RklyYfndYna42jVEbW7UA753e2iDdSn3KQTKdkL+tZegUw+9vxY75X44P31rGogK\r\n' +
|
||||
'N0mEYVWWjZ+++0uZOSO0ZKwfDf65AkI598c4Wh3qXEZvKyC75YQdDNNw7KBlTbrqok0VptS+\r\n' +
|
||||
'4wok309KPbmRf5e/alUp+/B3vxOs7I7QStpjoh8jl64LhzMGlUYvpJDtC3gytK3KN9jTABEB\r\n' +
|
||||
'AAG0KVRlc3QgVXNlciA8c2FmZXdpdGhtZS50ZXN0dXNlckBnbWFpbC5jb20+iQEyBBABCAAm\r\n' +
|
||||
'BQJVFCgXBgsJCAcDAgkQRTDnvxQqhQQEFQgCCgMWAgECGwMCHgEAAAk9CACsT8cmBhWfNdEB\r\n' +
|
||||
'jTwiCJUwnE6YzYmxMqDkkkDXThZa45g0Mh2vJPSNw+kjdb8KM1L9KrqGwyN7DbYvRhEZTCKN\r\n' +
|
||||
'1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Ar2B/9vzF2gg9VlH/iXwRVHHqDuaqQ4aja5\r\n' +
|
||||
'rhU5rsOdhDYqjPRI8QT4EE4Ko0UyEF6UY9/T1gGpTVdFQWQk6c5tWG3+s6dPKMSlQ3oEnG+h\r\n' +
|
||||
'DuEw4MZZa7rzWOE2kxf5AHEue730uTZ+ekmLBRk2gdJGh/O9bXktSktRgtIylLVmlH/R24ij\r\n' +
|
||||
'CfHViQ1VxWhg7Db9YxeTpu9p0sl4EtkmfK4YczJ3H5Q+fAv8HuM9iOeWXUqxIYhdXb2e0uVd\r\n' +
|
||||
'nUxxgC1OTbUFYBTI5D+VoJFIA3/i6OBeEGrrfg7ufB3xYdUoSVtZQq756/jmd7ffh1oGz5Di\r\n' +
|
||||
'uw9LVuvHh8RGCH2NZY48zdfB\r\n' +
|
||||
'=5obP\r\n' +
|
||||
'-----END PGP PUBLIC KEY BLOCK-----';
|
||||
|
||||
const revocation_certificate = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
Comment: This is a revocation certificate
|
||||
const revocation_certificate = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
Comment: This is a revocation certificate
|
||||
|
||||
iQFFBCABCAAvFiEE6mWHlKTGvbGenE8BstiRuVIg7eYFAlxec9cRHQB0aGlzIGlz
|
||||
IGEgdGVzdC4ACgkQstiRuVIg7eZkywf/QuHU6WaOGmI635xsV8GNyvOOHzDpVuzM
|
||||
AYGIKOLf1l661aS1MIvbXGxI86a3CzLs3K9nqUS7uAZ89vhf6L8RDZSkpn2GzY3K
|
||||
JQb0ZM+qf2TGkVDZ/wI8H/BMkJGCLbvbn6Ywk/o4GQIl/ISJPQTiC5VixayLEUQ3
|
||||
6dnENegfEIptSOPNBOelRPfbT8tqcR6SxibjXYxlCqvdSgt7lui06vGcejl4qNgZ
|
||||
oNMuvQNShV2G9KkPda3AZWCIWzUBuKN5UuE06u68iclH2ckEicQvnmxHnJU/BSC9
|
||||
h3bdqlMa87hRGnWluKpJT+XRP0UGiN8UGWo8OEpdz8KbvVTCUVya4g==
|
||||
=Wjv9
|
||||
-----END PGP PUBLIC KEY BLOCK-----`
|
||||
iQFFBCABCAAvFiEE6mWHlKTGvbGenE8BstiRuVIg7eYFAlxec9cRHQB0aGlzIGlz
|
||||
IGEgdGVzdC4ACgkQstiRuVIg7eZkywf/QuHU6WaOGmI635xsV8GNyvOOHzDpVuzM
|
||||
AYGIKOLf1l661aS1MIvbXGxI86a3CzLs3K9nqUS7uAZ89vhf6L8RDZSkpn2GzY3K
|
||||
JQb0ZM+qf2TGkVDZ/wI8H/BMkJGCLbvbn6Ywk/o4GQIl/ISJPQTiC5VixayLEUQ3
|
||||
6dnENegfEIptSOPNBOelRPfbT8tqcR6SxibjXYxlCqvdSgt7lui06vGcejl4qNgZ
|
||||
oNMuvQNShV2G9KkPda3AZWCIWzUBuKN5UuE06u68iclH2ckEicQvnmxHnJU/BSC9
|
||||
h3bdqlMa87hRGnWluKpJT+XRP0UGiN8UGWo8OEpdz8KbvVTCUVya4g==
|
||||
=Wjv9
|
||||
-----END PGP PUBLIC KEY BLOCK-----`;
|
||||
|
||||
beforeEach(function() {
|
||||
hkp = new openpgp.HKP(openpgp.config.keyserver);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable max-lines */
|
||||
/* globals tryTests: true */
|
||||
|
||||
const openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../..');
|
||||
|
@ -94,7 +95,7 @@ nGHIp2NmbJZnYgl8Ps23qF+LKTa1eE+AmMQYzUHSGuka2lp6OglwWzg/dEw=
|
|||
=/vbH
|
||||
-----END PGP PUBLIC KEY BLOCK-----`;
|
||||
|
||||
const priv_key_arm4 = `-----BEGIN PGP PRIVATE KEY BLOCK-----
|
||||
/* const priv_key_arm4 = `-----BEGIN PGP PRIVATE KEY BLOCK-----
|
||||
Version: GnuPG 2.1.15 (GNU/Linux)
|
||||
|
||||
lQIGBFqaDSwBBADKDvHX5y77ws3tYY1nK/LdXzHZ3RUHNXwDO3ZurG6q3ZWgM/g2
|
||||
|
@ -128,7 +129,7 @@ uUrp9Qp76CnKqUsUjcVxq7DJBi/lewyGGYSVAFt6/0Xyg/8YTEa/c4Dri/HMOtrf
|
|||
bgjp/doIVaZLOXZYfqRcpy3z0M6BierOPB3D+fdaTfd7gIrQnGHIp2NmbJZnYgl8
|
||||
Ps23qF+LKTa1eE+AmMQYzUHSGuka2lp6OglwWzg/dEw=
|
||||
=mr3M
|
||||
-----END PGP PRIVATE KEY BLOCK-----`;
|
||||
-----END PGP PRIVATE KEY BLOCK-----`; */
|
||||
|
||||
const revocation_certificate_arm4 = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
Version: GnuPG 2.1.15 (GNU/Linux)
|
||||
|
@ -1407,7 +1408,7 @@ cKFQz1DDfFCfVpSIJRGozQ==
|
|||
-----END PGP PUBLIC KEY BLOCK-----
|
||||
`;
|
||||
|
||||
const revoked_primary_user = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
/* const revoked_primary_user = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
mQENBE2V9vABCADR6780VEDx0P/Hk+qvGeDkGY/CDKkFIquksfVnWUatmN4mVfcS
|
||||
yqzmyZ08kAcXQVlU1i+/EeFSQ6vXEP/ZjH9en4YjOGrvmSIrNl4j4vhlJG3Mbao0
|
||||
|
@ -1688,7 +1689,7 @@ dh1PTAyfau1IRO3V/ivRaYs32jvMno6zP575CKLJOIyLREm8dbQRRd7h1+ZBxtQf
|
|||
Jn9lY1FGcIqjyOYanmsOEsSsKZS/exyNIjwi0WRPze+SASRzE/8=
|
||||
=qfwW
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
||||
`;
|
||||
`; */
|
||||
|
||||
const key_created_2030 = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ const keyring = new openpgp.Keyring();
|
|||
|
||||
module.exports = () => describe("Keyring", async function() {
|
||||
const user = 'whiteout.test@t-online.de';
|
||||
const passphrase = 'asdf';
|
||||
const keySize = 512;
|
||||
// const passphrase = 'asdf';
|
||||
// const keySize = 512;
|
||||
const keyId = 'f6f60e9b42cdff4c';
|
||||
const keyFingerP = '5856cef789c3a307e8a1b976f6f60e9b42cdff4c';
|
||||
const pubkey = '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' +
|
||||
|
|
|
@ -24,12 +24,12 @@ module.exports = () => describe('Oid tests', function() {
|
|||
const oid = new OID();
|
||||
expect(oid.read(data)).to.equal(data.length);
|
||||
expect(oid.oid).to.exist;
|
||||
expect(oid.oid).to.have.length(data.length-1);
|
||||
expect(oid.oid).to.have.length(data.length - 1);
|
||||
expect(oid.toHex()).to.equal(util.uint8ArrayToHex(data.subarray(1)));
|
||||
const result = oid.write();
|
||||
expect(result).to.exist;
|
||||
expect(result).to.have.length(data.length);
|
||||
expect(result[0]).to.equal(data.length-1);
|
||||
expect(result[0]).to.equal(data.length - 1);
|
||||
expect(
|
||||
util.uint8ArrayToHex(result.subarray(1))
|
||||
).to.equal(util.uint8ArrayToHex(data.subarray(1)));
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable max-lines */
|
||||
/* globals tryTests: true */
|
||||
|
||||
const openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../..');
|
||||
|
@ -12,8 +13,8 @@ chai.use(require('chai-as-promised'));
|
|||
|
||||
const expect = chai.expect;
|
||||
|
||||
const pub_key =
|
||||
['-----BEGIN PGP PUBLIC KEY BLOCK-----',
|
||||
const pub_key = [
|
||||
'-----BEGIN PGP PUBLIC KEY BLOCK-----',
|
||||
'Version: GnuPG v2.0.19 (GNU/Linux)',
|
||||
'',
|
||||
'mI0EUmEvTgEEANyWtQQMOybQ9JltDqmaX0WnNPJeLILIM36sw6zL0nfTQ5zXSS3+',
|
||||
|
@ -35,10 +36,11 @@ const pub_key =
|
|||
'AtNTq6ihLMD5v1d82ZC7tNatdlDMGWnIdvEMCv2GZcuIqDQ9rXWs49e7tq1NncLY',
|
||||
'hz3tYjKhoFTKEIq3y3Pp',
|
||||
'=h/aX',
|
||||
'-----END PGP PUBLIC KEY BLOCK-----'].join('\n');
|
||||
'-----END PGP PUBLIC KEY BLOCK-----'
|
||||
].join('\n');
|
||||
|
||||
const priv_key =
|
||||
['-----BEGIN PGP PRIVATE KEY BLOCK-----',
|
||||
const priv_key = [
|
||||
'-----BEGIN PGP PRIVATE KEY BLOCK-----',
|
||||
'Version: GnuPG v2.0.19 (GNU/Linux)',
|
||||
'',
|
||||
'lQH+BFJhL04BBADclrUEDDsm0PSZbQ6pml9FpzTyXiyCyDN+rMOsy9J300Oc10kt',
|
||||
|
@ -75,10 +77,11 @@ const priv_key =
|
|||
'SXuqKcWqoEuO7OBSEFThCXBfUYMC01OrqKEswPm/V3zZkLu01q12UMwZach28QwK',
|
||||
'/YZly4ioND2tdazj17u2rU2dwtiHPe1iMqGgVMoQirfLc+k=',
|
||||
'=lw5e',
|
||||
'-----END PGP PRIVATE KEY BLOCK-----'].join('\n');
|
||||
'-----END PGP PRIVATE KEY BLOCK-----'
|
||||
].join('\n');
|
||||
|
||||
const pub_key_de =
|
||||
['-----BEGIN PGP PUBLIC KEY BLOCK-----',
|
||||
const pub_key_de = [
|
||||
'-----BEGIN PGP PUBLIC KEY BLOCK-----',
|
||||
'Version: GnuPG v2.0.22 (GNU/Linux)',
|
||||
'',
|
||||
'mQMuBFLVgdQRCACOlpq0cd1IazNjOEpWPZvx/O3JMbdDs3B3iCG0Mo5OUZ8lpKU5',
|
||||
|
@ -116,10 +119,11 @@ const pub_key_de =
|
|||
'y61IhKbJCOlQxyem+kepjNapkhKDAQDIDL38bZWU4Rm0nq82Xb4yaI0BCWDcFkHV',
|
||||
'og2umGfGng==',
|
||||
'=v3+L',
|
||||
'-----END PGP PUBLIC KEY BLOCK-----'].join('\n');
|
||||
'-----END PGP PUBLIC KEY BLOCK-----'
|
||||
].join('\n');
|
||||
|
||||
const priv_key_de =
|
||||
['-----BEGIN PGP PRIVATE KEY BLOCK-----',
|
||||
const priv_key_de = [
|
||||
'-----BEGIN PGP PRIVATE KEY BLOCK-----',
|
||||
'Version: GnuPG v2.0.22 (GNU/Linux)',
|
||||
'',
|
||||
'lQN5BFLVgdQRCACOlpq0cd1IazNjOEpWPZvx/O3JMbdDs3B3iCG0Mo5OUZ8lpKU5',
|
||||
|
@ -160,7 +164,8 @@ const priv_key_de =
|
|||
'ijpKCgD9HC+RyNOutHhPFbgSvyH3cY6Rbnh1MFAUH3SG4gmiE8kA/A679f/+Izs1',
|
||||
'DHTORVqAOdoOcu5Qh7AQg1GdSmfFAsx2',
|
||||
'=kyeP',
|
||||
'-----END PGP PRIVATE KEY BLOCK-----'].join('\n');
|
||||
'-----END PGP PRIVATE KEY BLOCK-----'
|
||||
].join('\n');
|
||||
|
||||
const priv_key_2000_2008 = `-----BEGIN PGP PRIVATE KEY BLOCK-----
|
||||
|
||||
|
@ -292,19 +297,20 @@ const passphrase = 'hello world';
|
|||
const plaintext = input.createSomeMessage();
|
||||
const password1 = 'I am a password';
|
||||
const password2 = 'I am another password';
|
||||
const password3 = 'I am a third password';
|
||||
|
||||
const twoPasswordGPGFail = ['-----BEGIN PGP MESSAGE-----',
|
||||
'Version: OpenPGP.js v3.0.0',
|
||||
'Comment: https://openpgpjs.org',
|
||||
'',
|
||||
'wy4ECQMIWjj3WEfWxGpgrfb3vXu0TS9L8UNTBvNZFIjltGjMVkLFD+/afgs5',
|
||||
'aXt0wy4ECQMIrFo3TFN5xqtgtB+AaAjBcWJrA4bvIPBpJ38PbMWeF0JQgrqg',
|
||||
'j3uehxXy0mUB5i7B61g0ho+YplyFGM0s9XayJCnu40tWmr5LqqsRxuwrhJKR',
|
||||
'migslOF/l6Y9F0F9xGIZWGhxp3ugQPjVKjj8fOH7ap14mLm60C8q8AOxiSmL',
|
||||
'ubsd/hL7FPZatUYAAZVA0a6hmQ==',
|
||||
'=cHCV',
|
||||
'-----END PGP MESSAGE-----'].join('\n');
|
||||
const twoPasswordGPGFail = [
|
||||
'-----BEGIN PGP MESSAGE-----',
|
||||
'Version: OpenPGP.js v3.0.0',
|
||||
'Comment: https://openpgpjs.org',
|
||||
'',
|
||||
'wy4ECQMIWjj3WEfWxGpgrfb3vXu0TS9L8UNTBvNZFIjltGjMVkLFD+/afgs5',
|
||||
'aXt0wy4ECQMIrFo3TFN5xqtgtB+AaAjBcWJrA4bvIPBpJ38PbMWeF0JQgrqg',
|
||||
'j3uehxXy0mUB5i7B61g0ho+YplyFGM0s9XayJCnu40tWmr5LqqsRxuwrhJKR',
|
||||
'migslOF/l6Y9F0F9xGIZWGhxp3ugQPjVKjj8fOH7ap14mLm60C8q8AOxiSmL',
|
||||
'ubsd/hL7FPZatUYAAZVA0a6hmQ==',
|
||||
'=cHCV',
|
||||
'-----END PGP MESSAGE-----'
|
||||
].join('\n');
|
||||
|
||||
const ecdh_msg_bad = `-----BEGIN PGP MESSAGE-----
|
||||
Version: ProtonMail
|
||||
|
@ -690,7 +696,7 @@ module.exports = () => describe('OpenPGP.js public api tests', function() {
|
|||
it('should work in JS', function() {
|
||||
openpgp.config.useNative = false;
|
||||
const opt = {
|
||||
userIds: [{ name: 'Test User', email: 'text@example.com' }],
|
||||
userIds: [{ name: 'Test User', email: 'text@example.com' }]
|
||||
};
|
||||
|
||||
return openpgp.generateKey(opt).then(function(newKey) {
|
||||
|
@ -703,7 +709,7 @@ module.exports = () => describe('OpenPGP.js public api tests', function() {
|
|||
it('should work in with native crypto', function() {
|
||||
openpgp.config.useNative = true;
|
||||
const opt = {
|
||||
userIds: [{ name: 'Test User', email: 'text@example.com' }],
|
||||
userIds: [{ name: 'Test User', email: 'text@example.com' }]
|
||||
};
|
||||
|
||||
return openpgp.generateKey(opt).then(function(newKey) {
|
||||
|
@ -1346,7 +1352,7 @@ module.exports = () => describe('OpenPGP.js public api tests', function() {
|
|||
|
||||
it('should encrypt/sign and decrypt/verify with generated key', function () {
|
||||
const genOpt = {
|
||||
userIds: [{ name: 'Test User', email: 'text@example.com' }],
|
||||
userIds: [{ name: 'Test User', email: 'text@example.com' }]
|
||||
};
|
||||
|
||||
return openpgp.generateKey(genOpt).then(async function(newKey) {
|
||||
|
@ -1378,7 +1384,7 @@ module.exports = () => describe('OpenPGP.js public api tests', function() {
|
|||
|
||||
it('should encrypt/sign and decrypt/verify with generated key and detached signatures', async function () {
|
||||
const newKey = await openpgp.generateKey({
|
||||
userIds: [{ name: 'Test User', email: 'text@example.com' }],
|
||||
userIds: [{ name: 'Test User', email: 'text@example.com' }]
|
||||
});
|
||||
const newPublicKey = await openpgp.readArmoredKey(newKey.publicKeyArmored);
|
||||
const newPrivateKey = await openpgp.readArmoredKey(newKey.privateKeyArmored);
|
||||
|
@ -1695,7 +1701,7 @@ module.exports = () => describe('OpenPGP.js public api tests', function() {
|
|||
expect(stepReached).to.equal(
|
||||
j === 0 ? 0 :
|
||||
(openpgp.config.aeadChunkSizeByte === 0 && (j === 2 || util.detectNode() || util.getHardwareConcurrency() < 8)) || (!openpgp.config.aeadProtect && openpgp.config.allowUnauthenticatedStream) ? 2 :
|
||||
1
|
||||
1
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -1744,56 +1750,58 @@ module.exports = () => describe('OpenPGP.js public api tests', function() {
|
|||
});
|
||||
|
||||
describe("3DES decrypt", function() {
|
||||
const pgp_msg =
|
||||
['-----BEGIN PGP MESSAGE-----',
|
||||
'Version: GnuPG/MacGPG2 v2.0.19 (Darwin)',
|
||||
'Comment: GPGTools - https://gpgtools.org',
|
||||
'',
|
||||
'hIwDBU4Dycfvp2EBA/9tuhQgOrcATcm2PRmIOcs6q947YhlsBTZZdVJDfVjkKlyM',
|
||||
'M0yE+lnNplWb041Cpfkkl6IvorKQd2iPbAkOL0IXwmVN41l+PvVgMcuFvvzetehG',
|
||||
'Ca0/VEYOaTZRNqyr9FIzcnVy1I/PaWT3iqVAYa+G8TEA5Dh9RLfsx8ZA9UNIaNI+',
|
||||
'ASm9aZ3H6FerNhm8RezDY5vRn6xw3o/wH5YEBvV2BEmmFKZ2BlqFQxqChr8UNwd1',
|
||||
'Ieebnq0HtBPE8YU/L0U=',
|
||||
'=JyIa',
|
||||
'-----END PGP MESSAGE-----'].join('\n');
|
||||
const pgp_msg = [
|
||||
'-----BEGIN PGP MESSAGE-----',
|
||||
'Version: GnuPG/MacGPG2 v2.0.19 (Darwin)',
|
||||
'Comment: GPGTools - https://gpgtools.org',
|
||||
'',
|
||||
'hIwDBU4Dycfvp2EBA/9tuhQgOrcATcm2PRmIOcs6q947YhlsBTZZdVJDfVjkKlyM',
|
||||
'M0yE+lnNplWb041Cpfkkl6IvorKQd2iPbAkOL0IXwmVN41l+PvVgMcuFvvzetehG',
|
||||
'Ca0/VEYOaTZRNqyr9FIzcnVy1I/PaWT3iqVAYa+G8TEA5Dh9RLfsx8ZA9UNIaNI+',
|
||||
'ASm9aZ3H6FerNhm8RezDY5vRn6xw3o/wH5YEBvV2BEmmFKZ2BlqFQxqChr8UNwd1',
|
||||
'Ieebnq0HtBPE8YU/L0U=',
|
||||
'=JyIa',
|
||||
'-----END PGP MESSAGE-----'
|
||||
].join('\n');
|
||||
|
||||
const priv_key =
|
||||
['-----BEGIN PGP PRIVATE KEY BLOCK-----',
|
||||
'Version: GnuPG/MacGPG2 v2.0.19 (Darwin)',
|
||||
'Comment: GPGTools - https://gpgtools.org',
|
||||
'',
|
||||
'lQH+BFLqLegBBAC/rN3g30Jrcpx5lTb7Kxe+ZfS7ppOIoBjjN+qcOh81cJJVS5dT',
|
||||
'UGcDsm2tCLVS3P2dGaYhfU9fsoSq/wK/tXsdoWXvXdjHbbueyi1kTZqlnyT190UE',
|
||||
'vmDxH0yqquvUaf7+CNXC0T6l9gGS9p0x7xNydWRb7zeK1wIsYI+dRGQmzQARAQAB',
|
||||
'/gMDArgQHMknurQXy0Pho3Nsdu6zCUNXuplvaSXruefKsQn6eexGPnecNTT2iy5N',
|
||||
'70EK371D7GcNhhLsn8roUcj1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fUHeMbPjboj2P2m2UOnSrbXK9qsDQ8XOMtdsEWGLWpmiqnMlkiOchv',
|
||||
'MsNRYpZ67iX3JVdxNuhs5+g5bdP1PNVbKiTzx73u1h0SS93IJp1jFj50/kyGl1Eq',
|
||||
'tkr0TWe5uXCh6cSZDPwhto0a12GeDHehdTw6Yq4KoZHccneHhN9ySFy0DZOeULIi',
|
||||
'Y61qtR0io52T7w69fBe9Q5/d5SwpwWKMpCTOqvvzdHX7JmeFtV+2vRVilIif7AfP',
|
||||
'AD+OjQ/OhMu3jYO+XNhm3raPT2tIBsBdl2UiHOnj4AUNuLuUJeVghtz4Qt6dvjyz',
|
||||
'PlBvSF+ESqALjM8IqnG15FX4LmEDFrFcfNCsnmeyZ2nr1h2mV5jOON0EmBtCyhCt',
|
||||
'D/Ivi4/SZk+tBVhsBI+7ZECZYDJzZQnyPDsUv31MU4OwdWi7FhzHvDj/0bhYY7+I',
|
||||
'nwQYAQIACQUCUuot6AIbDAAKCRCSTaGiPl24PwYAA/sGIHvCKWP5+4ZlBHuOdbP9',
|
||||
'9v3PXFCm61qFEL0DTSq7NgBcuf0ASRElRI3wIKlfkwaiSzVPfNLiMTexdc7XaiTz',
|
||||
'CHaOn1Xl2gmYTq2KiJkgtLuwptYU1iSj7vvSHKy0+nYIckOZB4pRCOjknT08O4ZJ',
|
||||
'22q10ausyQXoOxXfDWVwKA==',
|
||||
'=IkKW',
|
||||
'-----END PGP PRIVATE KEY BLOCK-----'].join('\n');
|
||||
const priv_key = [
|
||||
'-----BEGIN PGP PRIVATE KEY BLOCK-----',
|
||||
'Version: GnuPG/MacGPG2 v2.0.19 (Darwin)',
|
||||
'Comment: GPGTools - https://gpgtools.org',
|
||||
'',
|
||||
'lQH+BFLqLegBBAC/rN3g30Jrcpx5lTb7Kxe+ZfS7ppOIoBjjN+qcOh81cJJVS5dT',
|
||||
'UGcDsm2tCLVS3P2dGaYhfU9fsoSq/wK/tXsdoWXvXdjHbbueyi1kTZqlnyT190UE',
|
||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L',
|
||||
'vCKDC8D9ZJf13iwUjYkfn/e/bDqCS2piyd63zI0xDJo+s2bXCIJxgrhbOqFDeFd6',
|
||||
'4W8PfBOvUuRjABEBAAH+AwMCuBAcySe6tBfLV0P5MbBesR3Ifu/ppjzLoXKhwkqm',
|
||||
'PXf09taLcRfUHeMbPjboj2P2m2UOnSrbXK9qsDQ8XOMtdsEWGLWpmiqnMlkiOchv',
|
||||
'MsNRYpZ67iX3JVdxNuhs5+g5bdP1PNVbKiTzx73u1h0SS93IJp1jFj50/kyGl1Eq',
|
||||
'tkr0TWe5uXCh6cSZDPwhto0a12GeDHehdTw6Yq4KoZHccneHhN9ySFy0DZOeULIi',
|
||||
'Y61qtR0io52T7w69fBe9Q5/d5SwpwWKMpCTOqvvzdHX7JmeFtV+2vRVilIif7AfP',
|
||||
'AD+OjQ/OhMu3jYO+XNhm3raPT2tIBsBdl2UiHOnj4AUNuLuUJeVghtz4Qt6dvjyz',
|
||||
'PlBvSF+ESqALjM8IqnG15FX4LmEDFrFcfNCsnmeyZ2nr1h2mV5jOON0EmBtCyhCt',
|
||||
'D/Ivi4/SZk+tBVhsBI+7ZECZYDJzZQnyPDsUv31MU4OwdWi7FhzHvDj/0bhYY7+I',
|
||||
'nwQYAQIACQUCUuot6AIbDAAKCRCSTaGiPl24PwYAA/sGIHvCKWP5+4ZlBHuOdbP9',
|
||||
'9v3PXFCm61qFEL0DTSq7NgBcuf0ASRElRI3wIKlfkwaiSzVPfNLiMTexdc7XaiTz',
|
||||
'CHaOn1Xl2gmYTq2KiJkgtLuwptYU1iSj7vvSHKy0+nYIckOZB4pRCOjknT08O4ZJ',
|
||||
'22q10ausyQXoOxXfDWVwKA==',
|
||||
'=IkKW',
|
||||
'-----END PGP PRIVATE KEY BLOCK-----'
|
||||
].join('\n');
|
||||
|
||||
it('Decrypt message', async function() {
|
||||
const privKey = await openpgp.readArmoredKey(priv_key);
|
||||
|
@ -1902,14 +1910,14 @@ module.exports = () => describe('OpenPGP.js public api tests', function() {
|
|||
});
|
||||
|
||||
it('Streaming encrypt and decrypt small message roundtrip', async function() {
|
||||
let plaintext = [];
|
||||
const plaintext = [];
|
||||
let i = 0;
|
||||
const useNativeStream = (() => { try { new global.ReadableStream(); return true; } catch (e) { return false; } })();
|
||||
const useNativeStream = (() => { try { new global.ReadableStream(); return true; } catch (e) { return false; } })(); // eslint-disable-line no-new
|
||||
const ReadableStream = useNativeStream ? global.ReadableStream : openpgp.stream.ReadableStream;
|
||||
const data = new ReadableStream({
|
||||
async pull(controller) {
|
||||
if (i++ < 4) {
|
||||
let randomBytes = await random.getRandomBytes(10);
|
||||
const randomBytes = await random.getRandomBytes(10);
|
||||
controller.enqueue(randomBytes);
|
||||
plaintext.push(randomBytes.slice());
|
||||
} else {
|
||||
|
@ -2101,284 +2109,284 @@ module.exports = () => describe('OpenPGP.js public api tests', function() {
|
|||
});
|
||||
|
||||
it('should sign and verify data and not armor with detached signatures', function () {
|
||||
const start = util.normalizeDate();
|
||||
const message = openpgp.Message.fromText(plaintext);
|
||||
const signOpt = {
|
||||
message,
|
||||
privateKeys: privateKey,
|
||||
detached: true,
|
||||
armor: false
|
||||
};
|
||||
const verifyOpt = {
|
||||
message,
|
||||
publicKeys: publicKey
|
||||
};
|
||||
return openpgp.sign(signOpt).then(async function (signed) {
|
||||
verifyOpt.signature = await openpgp.readSignature(signed);
|
||||
return openpgp.verify(verifyOpt);
|
||||
}).then(async function (verified) {
|
||||
expect(verified.data).to.equal(plaintext);
|
||||
expect(+verified.signatures[0].signature.packets[0].created).to.be.lte(+util.normalizeDate());
|
||||
expect(+verified.signatures[0].signature.packets[0].created).to.be.gte(+start);
|
||||
expect(verified.signatures[0].valid).to.be.true;
|
||||
const signingKey = await privateKey.getSigningKey();
|
||||
expect(verified.signatures[0].keyid.toHex()).to.equal(signingKey.getKeyId().toHex());
|
||||
expect(verified.signatures[0].signature.packets.length).to.equal(1);
|
||||
});
|
||||
const start = util.normalizeDate();
|
||||
const message = openpgp.Message.fromText(plaintext);
|
||||
const signOpt = {
|
||||
message,
|
||||
privateKeys: privateKey,
|
||||
detached: true,
|
||||
armor: false
|
||||
};
|
||||
const verifyOpt = {
|
||||
message,
|
||||
publicKeys: publicKey
|
||||
};
|
||||
return openpgp.sign(signOpt).then(async function (signed) {
|
||||
verifyOpt.signature = await openpgp.readSignature(signed);
|
||||
return openpgp.verify(verifyOpt);
|
||||
}).then(async function (verified) {
|
||||
expect(verified.data).to.equal(plaintext);
|
||||
expect(+verified.signatures[0].signature.packets[0].created).to.be.lte(+util.normalizeDate());
|
||||
expect(+verified.signatures[0].signature.packets[0].created).to.be.gte(+start);
|
||||
expect(verified.signatures[0].valid).to.be.true;
|
||||
const signingKey = await privateKey.getSigningKey();
|
||||
expect(verified.signatures[0].keyid.toHex()).to.equal(signingKey.getKeyId().toHex());
|
||||
expect(verified.signatures[0].signature.packets.length).to.equal(1);
|
||||
});
|
||||
});
|
||||
|
||||
it('should sign and verify data with a date in the past', function () {
|
||||
const message = openpgp.Message.fromText(plaintext);
|
||||
const past = new Date(2000);
|
||||
const signOpt = {
|
||||
message,
|
||||
privateKeys: privateKey_1337,
|
||||
detached: true,
|
||||
date: past,
|
||||
armor: false
|
||||
};
|
||||
const verifyOpt = {
|
||||
message,
|
||||
publicKeys: publicKey_1337,
|
||||
date: past
|
||||
};
|
||||
return openpgp.sign(signOpt).then(async function (signed) {
|
||||
verifyOpt.signature = await openpgp.readSignature(signed);
|
||||
return openpgp.verify(verifyOpt).then(async function (verified) {
|
||||
expect(+verified.signatures[0].signature.packets[0].created).to.equal(+past);
|
||||
expect(verified.data).to.equal(plaintext);
|
||||
expect(verified.signatures[0].valid).to.be.true;
|
||||
expect(await privateKey_1337.getSigningKey(verified.signatures[0].keyid, past))
|
||||
.to.be.not.null;
|
||||
expect(verified.signatures[0].signature.packets.length).to.equal(1);
|
||||
// now check with expiration checking disabled
|
||||
verifyOpt.date = null;
|
||||
return openpgp.verify(verifyOpt);
|
||||
}).then(async function (verified) {
|
||||
expect(+verified.signatures[0].signature.packets[0].created).to.equal(+past);
|
||||
expect(verified.data).to.equal(plaintext);
|
||||
expect(verified.signatures[0].valid).to.be.true;
|
||||
expect(await privateKey_1337.getSigningKey(verified.signatures[0].keyid, null))
|
||||
.to.be.not.null;
|
||||
expect(verified.signatures[0].signature.packets.length).to.equal(1);
|
||||
});
|
||||
const message = openpgp.Message.fromText(plaintext);
|
||||
const past = new Date(2000);
|
||||
const signOpt = {
|
||||
message,
|
||||
privateKeys: privateKey_1337,
|
||||
detached: true,
|
||||
date: past,
|
||||
armor: false
|
||||
};
|
||||
const verifyOpt = {
|
||||
message,
|
||||
publicKeys: publicKey_1337,
|
||||
date: past
|
||||
};
|
||||
return openpgp.sign(signOpt).then(async function (signed) {
|
||||
verifyOpt.signature = await openpgp.readSignature(signed);
|
||||
return openpgp.verify(verifyOpt).then(async function (verified) {
|
||||
expect(+verified.signatures[0].signature.packets[0].created).to.equal(+past);
|
||||
expect(verified.data).to.equal(plaintext);
|
||||
expect(verified.signatures[0].valid).to.be.true;
|
||||
expect(await privateKey_1337.getSigningKey(verified.signatures[0].keyid, past))
|
||||
.to.be.not.null;
|
||||
expect(verified.signatures[0].signature.packets.length).to.equal(1);
|
||||
// now check with expiration checking disabled
|
||||
verifyOpt.date = null;
|
||||
return openpgp.verify(verifyOpt);
|
||||
}).then(async function (verified) {
|
||||
expect(+verified.signatures[0].signature.packets[0].created).to.equal(+past);
|
||||
expect(verified.data).to.equal(plaintext);
|
||||
expect(verified.signatures[0].valid).to.be.true;
|
||||
expect(await privateKey_1337.getSigningKey(verified.signatures[0].keyid, null))
|
||||
.to.be.not.null;
|
||||
expect(verified.signatures[0].signature.packets.length).to.equal(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should sign and verify binary data with a date in the future', function () {
|
||||
const future = new Date(2040, 5, 5, 5, 5, 5, 0);
|
||||
const data = new Uint8Array([3, 14, 15, 92, 65, 35, 59]);
|
||||
const signOpt = {
|
||||
message: openpgp.Message.fromBinary(data),
|
||||
privateKeys: privateKey_2038_2045,
|
||||
detached: true,
|
||||
date: future,
|
||||
armor: false
|
||||
};
|
||||
const verifyOpt = {
|
||||
publicKeys: publicKey_2038_2045,
|
||||
date: future,
|
||||
format: 'binary'
|
||||
};
|
||||
return openpgp.sign(signOpt).then(async function (signed) {
|
||||
verifyOpt.message = openpgp.Message.fromBinary(data);
|
||||
verifyOpt.signature = await openpgp.readSignature(signed);
|
||||
return openpgp.verify(verifyOpt);
|
||||
}).then(async function (verified) {
|
||||
expect(+verified.signatures[0].signature.packets[0].created).to.equal(+future);
|
||||
expect([].slice.call(verified.data)).to.deep.equal([].slice.call(data));
|
||||
expect(verified.signatures[0].valid).to.be.true;
|
||||
expect(await privateKey_2038_2045.getSigningKey(verified.signatures[0].keyid, future))
|
||||
.to.be.not.null;
|
||||
expect(verified.signatures[0].signature.packets.length).to.equal(1);
|
||||
});
|
||||
const future = new Date(2040, 5, 5, 5, 5, 5, 0);
|
||||
const data = new Uint8Array([3, 14, 15, 92, 65, 35, 59]);
|
||||
const signOpt = {
|
||||
message: openpgp.Message.fromBinary(data),
|
||||
privateKeys: privateKey_2038_2045,
|
||||
detached: true,
|
||||
date: future,
|
||||
armor: false
|
||||
};
|
||||
const verifyOpt = {
|
||||
publicKeys: publicKey_2038_2045,
|
||||
date: future,
|
||||
format: 'binary'
|
||||
};
|
||||
return openpgp.sign(signOpt).then(async function (signed) {
|
||||
verifyOpt.message = openpgp.Message.fromBinary(data);
|
||||
verifyOpt.signature = await openpgp.readSignature(signed);
|
||||
return openpgp.verify(verifyOpt);
|
||||
}).then(async function (verified) {
|
||||
expect(+verified.signatures[0].signature.packets[0].created).to.equal(+future);
|
||||
expect([].slice.call(verified.data)).to.deep.equal([].slice.call(data));
|
||||
expect(verified.signatures[0].valid).to.be.true;
|
||||
expect(await privateKey_2038_2045.getSigningKey(verified.signatures[0].keyid, future))
|
||||
.to.be.not.null;
|
||||
expect(verified.signatures[0].signature.packets.length).to.equal(1);
|
||||
});
|
||||
});
|
||||
|
||||
it('should sign and verify binary data without one-pass signature', function () {
|
||||
const data = new Uint8Array([3, 14, 15, 92, 65, 35, 59]);
|
||||
const signOpt = {
|
||||
message: openpgp.Message.fromBinary(data),
|
||||
privateKeys: privateKey,
|
||||
armor: false
|
||||
};
|
||||
const verifyOpt = {
|
||||
publicKeys: publicKey,
|
||||
format: 'binary'
|
||||
};
|
||||
return openpgp.sign(signOpt).then(async function (signed) {
|
||||
const message = await openpgp.readMessage(signed);
|
||||
message.packets.concat(await openpgp.stream.readToEnd(message.packets.stream, _ => _));
|
||||
const packets = new openpgp.PacketList();
|
||||
packets.push(message.packets.findPacket(openpgp.enums.packet.signature));
|
||||
packets.push(message.packets.findPacket(openpgp.enums.packet.literalData));
|
||||
verifyOpt.message = new openpgp.Message(packets);
|
||||
return openpgp.verify(verifyOpt);
|
||||
}).then(async function (verified) {
|
||||
expect([].slice.call(verified.data)).to.deep.equal([].slice.call(data));
|
||||
expect(verified.signatures[0].valid).to.be.true;
|
||||
expect(await privateKey.getSigningKey(verified.signatures[0].keyid))
|
||||
.to.be.not.null;
|
||||
expect(verified.signatures[0].signature.packets.length).to.equal(1);
|
||||
});
|
||||
const data = new Uint8Array([3, 14, 15, 92, 65, 35, 59]);
|
||||
const signOpt = {
|
||||
message: openpgp.Message.fromBinary(data),
|
||||
privateKeys: privateKey,
|
||||
armor: false
|
||||
};
|
||||
const verifyOpt = {
|
||||
publicKeys: publicKey,
|
||||
format: 'binary'
|
||||
};
|
||||
return openpgp.sign(signOpt).then(async function (signed) {
|
||||
const message = await openpgp.readMessage(signed);
|
||||
message.packets.concat(await openpgp.stream.readToEnd(message.packets.stream, _ => _));
|
||||
const packets = new openpgp.PacketList();
|
||||
packets.push(message.packets.findPacket(openpgp.enums.packet.signature));
|
||||
packets.push(message.packets.findPacket(openpgp.enums.packet.literalData));
|
||||
verifyOpt.message = new openpgp.Message(packets);
|
||||
return openpgp.verify(verifyOpt);
|
||||
}).then(async function (verified) {
|
||||
expect([].slice.call(verified.data)).to.deep.equal([].slice.call(data));
|
||||
expect(verified.signatures[0].valid).to.be.true;
|
||||
expect(await privateKey.getSigningKey(verified.signatures[0].keyid))
|
||||
.to.be.not.null;
|
||||
expect(verified.signatures[0].signature.packets.length).to.equal(1);
|
||||
});
|
||||
});
|
||||
|
||||
it('should streaming sign and verify binary data without one-pass signature', function () {
|
||||
const data = new Uint8Array([3, 14, 15, 92, 65, 35, 59]);
|
||||
const signOpt = {
|
||||
message: openpgp.Message.fromBinary(data),
|
||||
privateKeys: privateKey,
|
||||
armor: false,
|
||||
streaming: 'web'
|
||||
};
|
||||
const verifyOpt = {
|
||||
publicKeys: publicKey,
|
||||
streaming: 'web',
|
||||
format: 'binary'
|
||||
};
|
||||
const useNativeStream = (() => { try { new global.ReadableStream(); return true; } catch (e) { return false; } })();
|
||||
return openpgp.sign(signOpt).then(async function (signed) {
|
||||
expect(openpgp.stream.isStream(signed)).to.equal(useNativeStream ? 'web' : 'ponyfill');
|
||||
const message = await openpgp.readMessage(signed);
|
||||
message.packets.concat(await openpgp.stream.readToEnd(message.packets.stream, _ => _));
|
||||
const packets = new openpgp.PacketList();
|
||||
packets.push(message.packets.findPacket(openpgp.enums.packet.signature));
|
||||
packets.push(message.packets.findPacket(openpgp.enums.packet.literalData));
|
||||
verifyOpt.message = new openpgp.Message(packets);
|
||||
return openpgp.verify(verifyOpt);
|
||||
}).then(async function (verified) {
|
||||
expect(openpgp.stream.isStream(verified.data)).to.equal(useNativeStream ? 'web' : 'ponyfill');
|
||||
expect([].slice.call(await openpgp.stream.readToEnd(verified.data))).to.deep.equal([].slice.call(data));
|
||||
expect(await verified.signatures[0].verified).to.be.true;
|
||||
expect(await privateKey.getSigningKey(verified.signatures[0].keyid))
|
||||
.to.be.not.null;
|
||||
expect((await verified.signatures[0].signature).packets.length).to.equal(1);
|
||||
});
|
||||
const data = new Uint8Array([3, 14, 15, 92, 65, 35, 59]);
|
||||
const signOpt = {
|
||||
message: openpgp.Message.fromBinary(data),
|
||||
privateKeys: privateKey,
|
||||
armor: false,
|
||||
streaming: 'web'
|
||||
};
|
||||
const verifyOpt = {
|
||||
publicKeys: publicKey,
|
||||
streaming: 'web',
|
||||
format: 'binary'
|
||||
};
|
||||
const useNativeStream = (() => { try { new global.ReadableStream(); return true; } catch (e) { return false; } })(); // eslint-disable-line no-new
|
||||
return openpgp.sign(signOpt).then(async function (signed) {
|
||||
expect(openpgp.stream.isStream(signed)).to.equal(useNativeStream ? 'web' : 'ponyfill');
|
||||
const message = await openpgp.readMessage(signed);
|
||||
message.packets.concat(await openpgp.stream.readToEnd(message.packets.stream, _ => _));
|
||||
const packets = new openpgp.PacketList();
|
||||
packets.push(message.packets.findPacket(openpgp.enums.packet.signature));
|
||||
packets.push(message.packets.findPacket(openpgp.enums.packet.literalData));
|
||||
verifyOpt.message = new openpgp.Message(packets);
|
||||
return openpgp.verify(verifyOpt);
|
||||
}).then(async function (verified) {
|
||||
expect(openpgp.stream.isStream(verified.data)).to.equal(useNativeStream ? 'web' : 'ponyfill');
|
||||
expect([].slice.call(await openpgp.stream.readToEnd(verified.data))).to.deep.equal([].slice.call(data));
|
||||
expect(await verified.signatures[0].verified).to.be.true;
|
||||
expect(await privateKey.getSigningKey(verified.signatures[0].keyid))
|
||||
.to.be.not.null;
|
||||
expect((await verified.signatures[0].signature).packets.length).to.equal(1);
|
||||
});
|
||||
});
|
||||
|
||||
it('should encrypt and decrypt data with a date in the future', function () {
|
||||
const future = new Date(2040, 5, 5, 5, 5, 5, 0);
|
||||
const encryptOpt = {
|
||||
message: openpgp.Message.fromText(plaintext, undefined, future),
|
||||
publicKeys: publicKey_2038_2045,
|
||||
date: future,
|
||||
armor: false
|
||||
};
|
||||
const future = new Date(2040, 5, 5, 5, 5, 5, 0);
|
||||
const encryptOpt = {
|
||||
message: openpgp.Message.fromText(plaintext, undefined, future),
|
||||
publicKeys: publicKey_2038_2045,
|
||||
date: future,
|
||||
armor: false
|
||||
};
|
||||
|
||||
return openpgp.encrypt(encryptOpt).then(async function (encrypted) {
|
||||
const message = await openpgp.readMessage(encrypted);
|
||||
return message.decrypt([privateKey_2038_2045]);
|
||||
}).then(async function (packets) {
|
||||
const literals = packets.packets.filterByTag(openpgp.enums.packet.literalData);
|
||||
expect(literals.length).to.equal(1);
|
||||
expect(+literals[0].date).to.equal(+future);
|
||||
expect(await openpgp.stream.readToEnd(packets.getText())).to.equal(plaintext);
|
||||
});
|
||||
return openpgp.encrypt(encryptOpt).then(async function (encrypted) {
|
||||
const message = await openpgp.readMessage(encrypted);
|
||||
return message.decrypt([privateKey_2038_2045]);
|
||||
}).then(async function (packets) {
|
||||
const literals = packets.packets.filterByTag(openpgp.enums.packet.literalData);
|
||||
expect(literals.length).to.equal(1);
|
||||
expect(+literals[0].date).to.equal(+future);
|
||||
expect(await openpgp.stream.readToEnd(packets.getText())).to.equal(plaintext);
|
||||
});
|
||||
});
|
||||
|
||||
it('should encrypt and decrypt binary data with a date in the past', function () {
|
||||
const past = new Date(2005, 5, 5, 5, 5, 5, 0);
|
||||
const data = new Uint8Array([3, 14, 15, 92, 65, 35, 59]);
|
||||
const encryptOpt = {
|
||||
message: openpgp.Message.fromBinary(data, undefined, past),
|
||||
publicKeys: publicKey_2000_2008,
|
||||
date: past,
|
||||
armor: false
|
||||
};
|
||||
const past = new Date(2005, 5, 5, 5, 5, 5, 0);
|
||||
const data = new Uint8Array([3, 14, 15, 92, 65, 35, 59]);
|
||||
const encryptOpt = {
|
||||
message: openpgp.Message.fromBinary(data, undefined, past),
|
||||
publicKeys: publicKey_2000_2008,
|
||||
date: past,
|
||||
armor: false
|
||||
};
|
||||
|
||||
return openpgp.encrypt(encryptOpt).then(async function (encrypted) {
|
||||
const message = await openpgp.readMessage(encrypted);
|
||||
return message.decrypt([privateKey_2000_2008]);
|
||||
}).then(async function (packets) {
|
||||
const literals = packets.packets.filterByTag(openpgp.enums.packet.literalData);
|
||||
expect(literals.length).to.equal(1);
|
||||
expect(+literals[0].date).to.equal(+past);
|
||||
expect(await openpgp.stream.readToEnd(packets.getLiteralData())).to.deep.equal(data);
|
||||
});
|
||||
return openpgp.encrypt(encryptOpt).then(async function (encrypted) {
|
||||
const message = await openpgp.readMessage(encrypted);
|
||||
return message.decrypt([privateKey_2000_2008]);
|
||||
}).then(async function (packets) {
|
||||
const literals = packets.packets.filterByTag(openpgp.enums.packet.literalData);
|
||||
expect(literals.length).to.equal(1);
|
||||
expect(+literals[0].date).to.equal(+past);
|
||||
expect(await openpgp.stream.readToEnd(packets.getLiteralData())).to.deep.equal(data);
|
||||
});
|
||||
});
|
||||
|
||||
it('should sign, encrypt and decrypt, verify data with a date in the past', function () {
|
||||
const past = new Date(2005, 5, 5, 5, 5, 5, 0);
|
||||
const encryptOpt = {
|
||||
message: openpgp.Message.fromText(plaintext, undefined, past),
|
||||
publicKeys: publicKey_2000_2008,
|
||||
privateKeys: privateKey_2000_2008,
|
||||
date: past,
|
||||
armor: false
|
||||
};
|
||||
const past = new Date(2005, 5, 5, 5, 5, 5, 0);
|
||||
const encryptOpt = {
|
||||
message: openpgp.Message.fromText(plaintext, undefined, past),
|
||||
publicKeys: publicKey_2000_2008,
|
||||
privateKeys: privateKey_2000_2008,
|
||||
date: past,
|
||||
armor: false
|
||||
};
|
||||
|
||||
return openpgp.encrypt(encryptOpt).then(async function (encrypted) {
|
||||
const message = await openpgp.readMessage(encrypted);
|
||||
return message.decrypt([privateKey_2000_2008]);
|
||||
}).then(async function (message) {
|
||||
const literals = message.packets.filterByTag(openpgp.enums.packet.literalData);
|
||||
expect(literals.length).to.equal(1);
|
||||
expect(+literals[0].date).to.equal(+past);
|
||||
const signatures = await message.verify([publicKey_2000_2008], past);
|
||||
expect(await openpgp.stream.readToEnd(message.getText())).to.equal(plaintext);
|
||||
expect(+(await signatures[0].signature).packets[0].created).to.equal(+past);
|
||||
expect(await signatures[0].verified).to.be.true;
|
||||
expect(await privateKey_2000_2008.getSigningKey(signatures[0].keyid, past))
|
||||
.to.be.not.null;
|
||||
expect((await signatures[0].signature).packets.length).to.equal(1);
|
||||
});
|
||||
return openpgp.encrypt(encryptOpt).then(async function (encrypted) {
|
||||
const message = await openpgp.readMessage(encrypted);
|
||||
return message.decrypt([privateKey_2000_2008]);
|
||||
}).then(async function (message) {
|
||||
const literals = message.packets.filterByTag(openpgp.enums.packet.literalData);
|
||||
expect(literals.length).to.equal(1);
|
||||
expect(+literals[0].date).to.equal(+past);
|
||||
const signatures = await message.verify([publicKey_2000_2008], past);
|
||||
expect(await openpgp.stream.readToEnd(message.getText())).to.equal(plaintext);
|
||||
expect(+(await signatures[0].signature).packets[0].created).to.equal(+past);
|
||||
expect(await signatures[0].verified).to.be.true;
|
||||
expect(await privateKey_2000_2008.getSigningKey(signatures[0].keyid, past))
|
||||
.to.be.not.null;
|
||||
expect((await signatures[0].signature).packets.length).to.equal(1);
|
||||
});
|
||||
});
|
||||
|
||||
it('should sign, encrypt and decrypt, verify binary data with a date in the future', function () {
|
||||
const future = new Date(2040, 5, 5, 5, 5, 5, 0);
|
||||
const data = new Uint8Array([3, 14, 15, 92, 65, 35, 59]);
|
||||
const encryptOpt = {
|
||||
message: openpgp.Message.fromBinary(data, undefined, future),
|
||||
publicKeys: publicKey_2038_2045,
|
||||
privateKeys: privateKey_2038_2045,
|
||||
date: future,
|
||||
armor: false
|
||||
};
|
||||
const future = new Date(2040, 5, 5, 5, 5, 5, 0);
|
||||
const data = new Uint8Array([3, 14, 15, 92, 65, 35, 59]);
|
||||
const encryptOpt = {
|
||||
message: openpgp.Message.fromBinary(data, undefined, future),
|
||||
publicKeys: publicKey_2038_2045,
|
||||
privateKeys: privateKey_2038_2045,
|
||||
date: future,
|
||||
armor: false
|
||||
};
|
||||
|
||||
return openpgp.encrypt(encryptOpt).then(async function (encrypted) {
|
||||
const message = await openpgp.readMessage(encrypted);
|
||||
return message.decrypt([privateKey_2038_2045]);
|
||||
}).then(async function (message) {
|
||||
const literals = message.packets.filterByTag(openpgp.enums.packet.literalData);
|
||||
expect(literals.length).to.equal(1);
|
||||
expect(literals[0].format).to.equal('binary');
|
||||
expect(+literals[0].date).to.equal(+future);
|
||||
const signatures = await message.verify([publicKey_2038_2045], future);
|
||||
expect(await openpgp.stream.readToEnd(message.getLiteralData())).to.deep.equal(data);
|
||||
expect(+(await signatures[0].signature).packets[0].created).to.equal(+future);
|
||||
expect(await signatures[0].verified).to.be.true;
|
||||
expect(await privateKey_2038_2045.getSigningKey(signatures[0].keyid, future))
|
||||
.to.be.not.null;
|
||||
expect((await signatures[0].signature).packets.length).to.equal(1);
|
||||
});
|
||||
return openpgp.encrypt(encryptOpt).then(async function (encrypted) {
|
||||
const message = await openpgp.readMessage(encrypted);
|
||||
return message.decrypt([privateKey_2038_2045]);
|
||||
}).then(async function (message) {
|
||||
const literals = message.packets.filterByTag(openpgp.enums.packet.literalData);
|
||||
expect(literals.length).to.equal(1);
|
||||
expect(literals[0].format).to.equal('binary');
|
||||
expect(+literals[0].date).to.equal(+future);
|
||||
const signatures = await message.verify([publicKey_2038_2045], future);
|
||||
expect(await openpgp.stream.readToEnd(message.getLiteralData())).to.deep.equal(data);
|
||||
expect(+(await signatures[0].signature).packets[0].created).to.equal(+future);
|
||||
expect(await signatures[0].verified).to.be.true;
|
||||
expect(await privateKey_2038_2045.getSigningKey(signatures[0].keyid, future))
|
||||
.to.be.not.null;
|
||||
expect((await signatures[0].signature).packets.length).to.equal(1);
|
||||
});
|
||||
});
|
||||
|
||||
it('should sign, encrypt and decrypt, verify mime data with a date in the future', function () {
|
||||
const future = new Date(2040, 5, 5, 5, 5, 5, 0);
|
||||
const data = new Uint8Array([3, 14, 15, 92, 65, 35, 59]);
|
||||
const encryptOpt = {
|
||||
message: openpgp.Message.fromBinary(data, undefined, future, 'mime'),
|
||||
publicKeys: publicKey_2038_2045,
|
||||
privateKeys: privateKey_2038_2045,
|
||||
date: future,
|
||||
armor: false
|
||||
};
|
||||
const future = new Date(2040, 5, 5, 5, 5, 5, 0);
|
||||
const data = new Uint8Array([3, 14, 15, 92, 65, 35, 59]);
|
||||
const encryptOpt = {
|
||||
message: openpgp.Message.fromBinary(data, undefined, future, 'mime'),
|
||||
publicKeys: publicKey_2038_2045,
|
||||
privateKeys: privateKey_2038_2045,
|
||||
date: future,
|
||||
armor: false
|
||||
};
|
||||
|
||||
return openpgp.encrypt(encryptOpt).then(async function (encrypted) {
|
||||
const message = await openpgp.readMessage(encrypted);
|
||||
return message.decrypt([privateKey_2038_2045]);
|
||||
}).then(async function (message) {
|
||||
const literals = message.packets.filterByTag(openpgp.enums.packet.literalData);
|
||||
expect(literals.length).to.equal(1);
|
||||
expect(literals[0].format).to.equal('mime');
|
||||
expect(+literals[0].date).to.equal(+future);
|
||||
const signatures = await message.verify([publicKey_2038_2045], future);
|
||||
expect(await openpgp.stream.readToEnd(message.getLiteralData())).to.deep.equal(data);
|
||||
expect(+(await signatures[0].signature).packets[0].created).to.equal(+future);
|
||||
expect(await signatures[0].verified).to.be.true;
|
||||
expect(await privateKey_2038_2045.getSigningKey(signatures[0].keyid, future))
|
||||
.to.be.not.null;
|
||||
expect((await signatures[0].signature).packets.length).to.equal(1);
|
||||
});
|
||||
return openpgp.encrypt(encryptOpt).then(async function (encrypted) {
|
||||
const message = await openpgp.readMessage(encrypted);
|
||||
return message.decrypt([privateKey_2038_2045]);
|
||||
}).then(async function (message) {
|
||||
const literals = message.packets.filterByTag(openpgp.enums.packet.literalData);
|
||||
expect(literals.length).to.equal(1);
|
||||
expect(literals[0].format).to.equal('mime');
|
||||
expect(+literals[0].date).to.equal(+future);
|
||||
const signatures = await message.verify([publicKey_2038_2045], future);
|
||||
expect(await openpgp.stream.readToEnd(message.getLiteralData())).to.deep.equal(data);
|
||||
expect(+(await signatures[0].signature).packets[0].created).to.equal(+future);
|
||||
expect(await signatures[0].verified).to.be.true;
|
||||
expect(await privateKey_2038_2045.getSigningKey(signatures[0].keyid, future))
|
||||
.to.be.not.null;
|
||||
expect((await signatures[0].signature).packets.length).to.equal(1);
|
||||
});
|
||||
});
|
||||
|
||||
it('should fail to encrypt with revoked key', function() {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable max-lines */
|
||||
|
||||
const openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../..');
|
||||
const crypto = require('../../src/crypto');
|
||||
const util = require('../../src/util');
|
||||
|
@ -8,7 +10,6 @@ chai.use(require('chai-as-promised'));
|
|||
|
||||
const { expect } = chai;
|
||||
const input = require('./testInputs.js');
|
||||
const { PacketList } = require('../../dist/node/openpgp.min');
|
||||
|
||||
function stringify(array) {
|
||||
if (openpgp.stream.isStream(array)) {
|
||||
|
@ -154,7 +155,7 @@ module.exports = () => describe("Packet", function() {
|
|||
});
|
||||
|
||||
it('Sym. encrypted AEAD protected packet (AEAD)', async function() {
|
||||
let aeadProtectVal = openpgp.config.aeadProtect;
|
||||
const aeadProtectVal = openpgp.config.aeadProtect;
|
||||
openpgp.config.aeadProtect = true;
|
||||
const testText = input.createSomeMessage();
|
||||
|
||||
|
@ -188,14 +189,14 @@ module.exports = () => describe("Packet", function() {
|
|||
cryptStub.onCall(0).callsFake(async function() {
|
||||
cryptCallsActive++;
|
||||
try {
|
||||
return await crypt.apply(this, arguments);
|
||||
return await crypt.apply(this, arguments); // eslint-disable-line no-invalid-this
|
||||
} finally {
|
||||
cryptCallsActive--;
|
||||
}
|
||||
});
|
||||
cryptStub.onCall(1).callsFake(function() {
|
||||
expect(cryptCallsActive).to.equal(1);
|
||||
return crypt.apply(this, arguments);
|
||||
return crypt.apply(this, arguments); // eslint-disable-line no-invalid-this
|
||||
});
|
||||
cryptStub.callThrough();
|
||||
return cryptStub;
|
||||
|
@ -207,8 +208,8 @@ module.exports = () => describe("Packet", function() {
|
|||
const encryptStub = cryptStub(webCrypto, 'encrypt');
|
||||
const decryptStub = cryptStub(webCrypto, 'decrypt');
|
||||
|
||||
let aeadProtectVal = openpgp.config.aeadProtect;
|
||||
let aeadChunkSizeByteVal = openpgp.config.aeadChunkSizeByte;
|
||||
const aeadProtectVal = openpgp.config.aeadProtect;
|
||||
const aeadChunkSizeByteVal = openpgp.config.aeadChunkSizeByte;
|
||||
openpgp.config.aeadProtect = true;
|
||||
openpgp.config.aeadChunkSizeByte = 0;
|
||||
const testText = input.createSomeMessage();
|
||||
|
@ -248,7 +249,7 @@ module.exports = () => describe("Packet", function() {
|
|||
const nodeCrypto = util.getNodeCrypto();
|
||||
if (!nodeCrypto) return;
|
||||
|
||||
let packetBytes = util.hexToUint8Array(`
|
||||
const packetBytes = util.hexToUint8Array(`
|
||||
d4 4a 01 07 01 0e b7 32 37 9f 73 c4 92 8d e2 5f
|
||||
ac fe 65 17 ec 10 5d c1 1a 81 dc 0c b8 a2 f6 f3
|
||||
d9 00 16 38 4a 56 fc 82 1a e1 1a e8 db cb 49 86
|
||||
|
@ -256,8 +257,8 @@ module.exports = () => describe("Packet", function() {
|
|||
ab 01 3d e1 25 95 86 90 6e ab 24 76
|
||||
`.replace(/\s+/g, ''));
|
||||
|
||||
let aeadProtectVal = openpgp.config.aeadProtect;
|
||||
let aeadChunkSizeByteVal = openpgp.config.aeadChunkSizeByte;
|
||||
const aeadProtectVal = openpgp.config.aeadProtect;
|
||||
const aeadChunkSizeByteVal = openpgp.config.aeadChunkSizeByte;
|
||||
openpgp.config.aeadProtect = true;
|
||||
openpgp.config.aeadChunkSizeByte = 14;
|
||||
|
||||
|
@ -276,7 +277,7 @@ module.exports = () => describe("Packet", function() {
|
|||
|
||||
const msg2 = new openpgp.PacketList();
|
||||
|
||||
let randomBytesStub = stub(nodeCrypto, 'randomBytes');
|
||||
const randomBytesStub = stub(nodeCrypto, 'randomBytes');
|
||||
randomBytesStub.returns(iv);
|
||||
|
||||
try {
|
||||
|
@ -485,7 +486,7 @@ module.exports = () => describe("Packet", function() {
|
|||
});
|
||||
|
||||
it('Sym. encrypted session key reading/writing (AEAD)', async function() {
|
||||
let aeadProtectVal = openpgp.config.aeadProtect;
|
||||
const aeadProtectVal = openpgp.config.aeadProtect;
|
||||
openpgp.config.aeadProtect = true;
|
||||
|
||||
try {
|
||||
|
@ -529,25 +530,25 @@ module.exports = () => describe("Packet", function() {
|
|||
const nodeCrypto = util.getNodeCrypto();
|
||||
if (!nodeCrypto) return;
|
||||
|
||||
let aeadProtectVal = openpgp.config.aeadProtect;
|
||||
let aeadChunkSizeByteVal = openpgp.config.aeadChunkSizeByte;
|
||||
let s2kIterationCountByteVal = openpgp.config.s2kIterationCountByte;
|
||||
const aeadProtectVal = openpgp.config.aeadProtect;
|
||||
const aeadChunkSizeByteVal = openpgp.config.aeadChunkSizeByte;
|
||||
const s2kIterationCountByteVal = openpgp.config.s2kIterationCountByte;
|
||||
openpgp.config.aeadProtect = true;
|
||||
openpgp.config.aeadChunkSizeByte = 14;
|
||||
openpgp.config.s2kIterationCountByte = 0x90;
|
||||
|
||||
let salt = util.hexToUint8Array(`cd5a9f70fbe0bc65`);
|
||||
let sessionKey = util.hexToUint8Array(`86 f1 ef b8 69 52 32 9f 24 ac d3 bf d0 e5 34 6d`.replace(/\s+/g, ''));
|
||||
let sessionIV = util.hexToUint8Array(`bc 66 9e 34 e5 00 dc ae dc 5b 32 aa 2d ab 02 35`.replace(/\s+/g, ''));
|
||||
let dataIV = util.hexToUint8Array(`b7 32 37 9f 73 c4 92 8d e2 5f ac fe 65 17 ec 10`.replace(/\s+/g, ''));
|
||||
const salt = util.hexToUint8Array(`cd5a9f70fbe0bc65`);
|
||||
const sessionKey = util.hexToUint8Array(`86 f1 ef b8 69 52 32 9f 24 ac d3 bf d0 e5 34 6d`.replace(/\s+/g, ''));
|
||||
const sessionIV = util.hexToUint8Array(`bc 66 9e 34 e5 00 dc ae dc 5b 32 aa 2d ab 02 35`.replace(/\s+/g, ''));
|
||||
const dataIV = util.hexToUint8Array(`b7 32 37 9f 73 c4 92 8d e2 5f ac fe 65 17 ec 10`.replace(/\s+/g, ''));
|
||||
|
||||
let randomBytesStub = stub(nodeCrypto, 'randomBytes');
|
||||
const randomBytesStub = stub(nodeCrypto, 'randomBytes');
|
||||
randomBytesStub.onCall(0).returns(salt);
|
||||
randomBytesStub.onCall(1).returns(sessionKey);
|
||||
randomBytesStub.onCall(2).returns(sessionIV);
|
||||
randomBytesStub.onCall(3).returns(dataIV);
|
||||
|
||||
let packetBytes = util.hexToUint8Array(`
|
||||
const packetBytes = util.hexToUint8Array(`
|
||||
c3 3e 05 07 01 03 08 cd 5a 9f 70 fb e0 bc 65 90
|
||||
bc 66 9e 34 e5 00 dc ae dc 5b 32 aa 2d ab 02 35
|
||||
9d ee 19 d0 7c 34 46 c4 31 2a 34 ae 19 67 a2 fb
|
||||
|
@ -607,25 +608,25 @@ module.exports = () => describe("Packet", function() {
|
|||
const nodeCrypto = util.getNodeCrypto();
|
||||
if (!nodeCrypto) return;
|
||||
|
||||
let aeadProtectVal = openpgp.config.aeadProtect;
|
||||
let aeadChunkSizeByteVal = openpgp.config.aeadChunkSizeByte;
|
||||
let s2kIterationCountByteVal = openpgp.config.s2kIterationCountByte;
|
||||
const aeadProtectVal = openpgp.config.aeadProtect;
|
||||
const aeadChunkSizeByteVal = openpgp.config.aeadChunkSizeByte;
|
||||
const s2kIterationCountByteVal = openpgp.config.s2kIterationCountByte;
|
||||
openpgp.config.aeadProtect = true;
|
||||
openpgp.config.aeadChunkSizeByte = 14;
|
||||
openpgp.config.s2kIterationCountByte = 0x90;
|
||||
|
||||
let salt = util.hexToUint8Array(`9f0b7da3e5ea6477`);
|
||||
let sessionKey = util.hexToUint8Array(`d1 f0 1b a3 0e 13 0a a7 d2 58 2c 16 e0 50 ae 44`.replace(/\s+/g, ''));
|
||||
let sessionIV = util.hexToUint8Array(`99 e3 26 e5 40 0a 90 93 6c ef b4 e8 eb a0 8c`.replace(/\s+/g, ''));
|
||||
let dataIV = util.hexToUint8Array(`5e d2 bc 1e 47 0a be 8f 1d 64 4c 7a 6c 8a 56`.replace(/\s+/g, ''));
|
||||
const salt = util.hexToUint8Array(`9f0b7da3e5ea6477`);
|
||||
const sessionKey = util.hexToUint8Array(`d1 f0 1b a3 0e 13 0a a7 d2 58 2c 16 e0 50 ae 44`.replace(/\s+/g, ''));
|
||||
const sessionIV = util.hexToUint8Array(`99 e3 26 e5 40 0a 90 93 6c ef b4 e8 eb a0 8c`.replace(/\s+/g, ''));
|
||||
const dataIV = util.hexToUint8Array(`5e d2 bc 1e 47 0a be 8f 1d 64 4c 7a 6c 8a 56`.replace(/\s+/g, ''));
|
||||
|
||||
let randomBytesStub = stub(nodeCrypto, 'randomBytes');
|
||||
const randomBytesStub = stub(nodeCrypto, 'randomBytes');
|
||||
randomBytesStub.onCall(0).returns(salt);
|
||||
randomBytesStub.onCall(1).returns(sessionKey);
|
||||
randomBytesStub.onCall(2).returns(sessionIV);
|
||||
randomBytesStub.onCall(3).returns(dataIV);
|
||||
|
||||
let packetBytes = util.hexToUint8Array(`
|
||||
const packetBytes = util.hexToUint8Array(`
|
||||
c3 3d 05 07 02 03 08 9f 0b 7d a3 e5 ea 64 77 90
|
||||
99 e3 26 e5 40 0a 90 93 6c ef b4 e8 eb a0 8c 67
|
||||
73 71 6d 1f 27 14 54 0a 38 fc ac 52 99 49 da c5
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/* eslint-disable max-lines */
|
||||
/* globals tryTests: true */
|
||||
|
||||
const openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../..');
|
||||
const util = require('../../src/util');
|
||||
|
||||
|
@ -658,169 +661,171 @@ Blk+CJ7ytHy6En8542bB/yC+Z9/zWbVuhg==
|
|||
=jmT1
|
||||
-----END PGP PUBLIC KEY BLOCK-----`;
|
||||
|
||||
const msg_sig_expired =
|
||||
['-----BEGIN PGP MESSAGE-----',
|
||||
'Comment: GPGTools - https://gpgtools.org',
|
||||
'',
|
||||
'owEBWwKk/ZANAwAKAeyAexA3gWZ0AawUYgloZWxsby50eHRaX2WpaGVsbG+JAjME',
|
||||
'AAEKAB0WIQTxcIn7ZRrhwd51IZbsgHsQN4FmdAUCWl9lqQAKCRDsgHsQN4FmdCln',
|
||||
'D/44x1bcrOXg+DbRStSrC75wFa+cvPEmaTZyqN6d7qlQCMxOcPlq6lbZ74QWfEq7',
|
||||
'i1ZYHp4AU8jALw0QqBQQE5FvABleQKpVfY22s83Bqy+P0DB9ntpD+t+oZrxGCLmL',
|
||||
'MbZJNFnGro48gHt+/OQKLuftiVwE2opHfgogVKNL74FmYA0hMItdzpn4OPNFkP8t',
|
||||
'Iq/m0hkXlTAKqBPITVLv1FN16v+Sm1iC317eP/HOTYqVZdJN3svVF8ZBfg29a8p6',
|
||||
'6nl67fZhXgrt0OB6KSNIZEwMTWjFAqi365mtTssqAA0un94+cQ/WvAC5QcMM8g5S',
|
||||
'i3G7vny9AsXor+GDU1z7UDWs3wBV4mVRdj7bBIS6PK+6oe012aNpRObcI2bU2BT/',
|
||||
'H/7uHZWfwEmpfvH9RVZgoeETA3vSx7MDrNyDt3gwv2hxOHEd7nnVQ3EKG33173o1',
|
||||
'/5/oEmn2USujKGhHJ2Zo3aWNRuUWZlvBaYw+PwB2R0UiuJbi0KofNYPssNdpw4sg',
|
||||
'Qs7Nb2/Ilo1zn5bDh+WDrUrn6zHKAfBytBPpwPFWPZ8W10HUlC5vMZSKH5/UZhj5',
|
||||
'kLlUC1zKjFPpRhO27ImTJuImil4lR2/CFjB1duG3JGJQaYIq8RFJOjvTVY29wl0i',
|
||||
'pFy6y1Ofv2lLHB9K7N7dvvee2nvpUMkLEL52oFQ6Jc7sdg==',
|
||||
'=Q4tk',
|
||||
'-----END PGP MESSAGE-----'].join('\n');
|
||||
const msg_sig_expired = [
|
||||
'-----BEGIN PGP MESSAGE-----',
|
||||
'Comment: GPGTools - https://gpgtools.org',
|
||||
'',
|
||||
'owEBWwKk/ZANAwAKAeyAexA3gWZ0AawUYgloZWxsby50eHRaX2WpaGVsbG+JAjME',
|
||||
'AAEKAB0WIQTxcIn7ZRrhwd51IZbsgHsQN4FmdAUCWl9lqQAKCRDsgHsQN4FmdCln',
|
||||
'D/44x1bcrOXg+DbRStSrC75wFa+cvPEmaTZyqN6d7qlQCMxOcPlq6lbZ74QWfEq7',
|
||||
'i1ZYHp4AU8jALw0QqBQQE5FvABleQKpVfY22s83Bqy+P0DB9ntpD+t+oZrxGCLmL',
|
||||
'MbZJNFnGro48gHt+/OQKLuftiVwE2opHfgogVKNL74FmYA0hMItdzpn4OPNFkP8t',
|
||||
'Iq/m0hkXlTAKqBPITVLv1FN16v+Sm1iC317eP/HOTYqVZdJN3svVF8ZBfg29a8p6',
|
||||
'6nl67fZhXgrt0OB6KSNIZEwMTWjFAqi365mtTssqAA0un94+cQ/WvAC5QcMM8g5S',
|
||||
'i3G7vny9AsXor+GDU1z7UDWs3wBV4mVRdj7bBIS6PK+6oe012aNpRObcI2bU2BT/',
|
||||
'H/7uHZWfwEmpfvH9RVZgoeETA3vSx7MDrNyDt3gwv2hxOHEd7nnVQ3EKG33173o1',
|
||||
'/5/oEmn2USujKGhHJ2Zo3aWNRuUWZlvBaYw+PwB2R0UiuJbi0KofNYPssNdpw4sg',
|
||||
'Qs7Nb2/Ilo1zn5bDh+WDrUrn6zHKAfBytBPpwPFWPZ8W10HUlC5vMZSKH5/UZhj5',
|
||||
'kLlUC1zKjFPpRhO27ImTJuImil4lR2/CFjB1duG3JGJQaYIq8RFJOjvTVY29wl0i',
|
||||
'pFy6y1Ofv2lLHB9K7N7dvvee2nvpUMkLEL52oFQ6Jc7sdg==',
|
||||
'=Q4tk',
|
||||
'-----END PGP MESSAGE-----'
|
||||
].join('\n');
|
||||
|
||||
const flowcrypt_stripped_key =
|
||||
['-----BEGIN PGP PRIVATE KEY BLOCK-----',
|
||||
'',
|
||||
'lQIVBFttsQgBEADZT3v1LUGqP/hhUWmjfHVh6MErZAqsmbUIgsUKCDpQ4hrRpot2',
|
||||
'V3ZIMbbEGSjbUvyT/2quAtLRHx9/FK1MA3q0qVrUGmiXx78IiAuQ7sZOTjYXBDnq',
|
||||
'lJBL3Ux416nIWMwQ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wyW11Tgm2nYZQuV3aM/JhRs4RaqIp3G0D',
|
||||
'ZtJLP6u8HHLSAk08RftpLT1onM2REZiMiw4o5w+eAsEMTOVgWo4s0W6d3ZCg+1v6',
|
||||
'K8J9UM8JgdvqrfZuFsBUNAyFCqNycHY89R1usis4WWKJUoBh/jHL+4inCeiu/9pq',
|
||||
'U9wg9e0/FMFsltZGJHDH/9ohgTZdlvrB9dFDKXEKpFnydG0WPsC6ko9bWsIg7dJ2',
|
||||
'/OQECKetHE+s/cojEK4jpL9+wgsAEQEAAf4HAwLk886lftqoTMezJul7DJPduWMa',
|
||||
'ZjAkyjh5DJH2Sljwcrq473s0388hNoHNSwZBuDnEFxbsxivGPaiIm/VN84FYFvgr',
|
||||
'IRqIKOMEjaoj166rhadR3rOeCs6LJFTwBSMD+dO7zPo3eqAJBziQg7PqQ16DNLfu',
|
||||
'i3V2ZOvND+EbGYzAcpTToE3Cc6EhN2zB/+aIUAEvWRX2AkIozLNNmcfNHL11VI3X',
|
||||
'Rr3Z0eN9rkyOucVK9fwAR/3nDc7cLqFYgmU79DxHgHop7uWPtwP0/AAjzrhjNlXz',
|
||||
'7+rO2baiBbBu+MDaJi8TiRPbz1D28972wzJidIYUzQMsKrZKfqooQGXtamkvTRuR',
|
||||
'gTQgfspa671qwhni8WDDz9VQ0LlBothpAEBqlAtFe/nrUaEfLn5Im9ZI9lJ6SHoK',
|
||||
'e4vAHqimmxg1SWfZNhpnghaqTE7KjrmgMM674NDhThvUxw1MZSe+3uq6v5nYN60O',
|
||||
'rfSRYjuZpgO3cIJdDvGXv0vnuF2p9Z83pz3FS3dx33Weiss30pBt5pCvZKT8SAQp',
|
||||
'ityaxxYtDDb1t0fKmd59DByNfLaHl9pOPIs6adYL8ojFA2Qhd4walTl2+nkuWz9A',
|
||||
'tAUX9bKMG5SZe8DguQFtg/unM8HLcgWjycDrWg1EtJZAIHlZ0X4NMQiMjm0NjkC0',
|
||||
'qifHfRoM2UL427t5nsFPTq23wDt9LjrKIf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||
'hBr9NrB2VFHtdaWf2YqBGb7c1xusmEuGLcGUqFGCXo/g/lOSPijea91puCf9bgKy',
|
||||
'0P7n+O0V3W1QpkI4ne5TE2vBFUFo9K5IFe4qBI1JPjbLTfOI2lojx8P12+lqWug=',
|
||||
'=NbaL',
|
||||
'-----END PGP PRIVATE KEY BLOCK-----'].join("\n");
|
||||
const flowcrypt_stripped_key = [
|
||||
'-----BEGIN PGP PRIVATE KEY BLOCK-----',
|
||||
'',
|
||||
'lQIVBFttsQgBEADZT3v1LUGqP/hhUWmjfHVh6MErZAqsmbUIgsUKCDpQ4hrRpot2',
|
||||
'V3ZIMbbEGSjbUvyT/2quAtLRHx9/FK1MA3q0qVrUGmiXx78IiAuQ7sZOTjYXBDnq',
|
||||
'lJBL3Ux416nIWMwQnYYWL+kvSOfi2C0oMTeAO+5fiLmnbTp8cmGdW8Ry9Z3NJ8Oi',
|
||||
'HvjLyCbwYzMFEKS9qXN3wjO+4BIh4SB+MFOypeTshAI4NOEMU1x/ksXDK9G+M8J3',
|
||||
'AO5g0Ex9pGrRII/7xFLTLqZh4CaOxTx4y1Mq8qjJSZvulRgL6BSL01ylk4xDMeGG',
|
||||
'0S1ZitFKfIil90ZxEgI/kERN2UxeeEaK2d+wWhIOdhNZaNd+aueVQFJqxAtXOWld',
|
||||
'S7wrTgtvR62b9pO67HNNNlSG731Xnk07rVd2f/cTcOn0bFECZu2KXtaYB9vaW8qD',
|
||||
'nfuDHyFuYkc0azMTiMRLHnL+4Pyg/fDasRVG41VaBD09VlZRok3z5eQykoKPwmNS',
|
||||
'qLrBXa16K4cNw1wJ4TOpZK5E0T1iU4Fgr9OM1GsAZ5W/kTyzw75HAhjUtffwnWcp',
|
||||
'pSj8PqrViCNMRoo2sTKEX7Lo5nEpfjT4mQiWVVfLz+ye5aXyUS55ei9yijwVjzIE',
|
||||
'DCMo6kKF/MlWG0s17bL7P+kDTkMEOFeBKC0S/bnf/fB7Ij8cmHtsceRBcwARAQAB',
|
||||
'/w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zJidIYUzQMsKrZKfqooQGXtamkvTRuR',
|
||||
'gTQgfspa671qwhni8WDDz9VQ0LlBothpAEBqlAtFe/nrUaEfLn5Im9ZI9lJ6SHoK',
|
||||
'e4vAHqimmxg1SWfZNhpnghaqTE7KjrmgMM674NDhThvUxw1MZSe+3uq6v5nYN60O',
|
||||
'rfSRYjuZpgO3cIJdDvGXv0vnuF2p9Z83pz3FS3dx33Weiss30pBt5pCvZKT8SAQp',
|
||||
'ityaxxYtDDb1t0fKmd59DByNfLaHl9pOPIs6adYL8ojFA2Qhd4walTl2+nkuWz9A',
|
||||
'tAUX9bKMG5SZe8DguQFtg/unM8HLcgWjycDrWg1EtJZAIHlZ0X4NMQiMjm0NjkC0',
|
||||
'qifHfRoM2UL427t5nsFPTq23wDt9LjrKIfC/7GtOGaxU4HEjOokyNUnxI0aNR99o',
|
||||
'mIHQyTJHttl9giYeMB/DPIFZfQkQMcnRTytGFddsMKQ99gu+SPPrTvvS31VOrvhw',
|
||||
'8Y56n8kQJVLcBwi7FXsYgsbi6MbhUDWk9hGq+cBvYHlSpfyVRKDTgeHQjojsN03j',
|
||||
'm0QOXFpwzTd/q38rZuTGw/w/96SjECSF9IeSJxA842OCx+pj1VxxR9MW7b7dEz4R',
|
||||
'IBZ4Zd23GMy81LydtyqY2wkJtdjpKxs/LSE1Eym68s8f0uKQTHVaRD0frVyH6L2d',
|
||||
'nI7aOggpEJc/kwX6q52VuVKG/1gC4taPePU3ieF4Mt602zIPoqmoIzLcoKYev4MA',
|
||||
'DOhCYQcrFUoRT3o9aHN2MoGQvuRuaXWtDMD/SH9a57GEQ4czOjxDAfsxCtZb2j4h',
|
||||
'yVdPLBYbYGBCe0KUYPc4lBOYN+ccLykdgg8cjHRHEyogyp50NBXP2oNJtuJSYock',
|
||||
'YNeKWuhUD3PVrGQDAGGgoR9NEqj/RmzT/w5/1F1CfGG1udfs7XJ+/ON1diDPK6GF',
|
||||
'7/+3RLryVDJOFTlh2qqDKDdqtPftVpWj70Wlo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uwAzp1H11nHbg8RvoWjfq0aNPdcoeGcHq8w3XI5ygHWYOf0FsI51kCo',
|
||||
'vgaelhsFnh6xa0D3ABEBAAH+BwMCfVtrVpU1RSjHycjdFwHo+IOYCV7GbYQhM5sU',
|
||||
'zmIB8jqAbvpPxT61hLDOq5wpmBLMMdPIjcku2yUNnFBFM7GInKexOiotjAcnkRNo',
|
||||
'96rY9e1r+tnV7ZFXenaqwE/TP2i051AnXAUB3BY2dnua9Xs11r0Q9awB9lh/9jpK',
|
||||
'0piXJTtLRz2JD9stKF5NDVEWeOewOoUOO/bhHmCSnxd08gIZA+CPUSHMuvdqkKye',
|
||||
'VgSzKO17F3jFN6eHilO+0OLiM7ryfIGJgrUrqv8wGet5KLGE7WkvFp3nCZJIQ17R',
|
||||
'z1LlVvpWEiuziSwSiY/kHxYODhiV38K/00/UzVD+RwzEOsfo6Aygpw7Hx6ersvzE',
|
||||
'WocNKfMKjl3o5KNOHjNeh5s8gXclYDJ6CcAQhAL0dw8/8Ym0wWZxRs3cOj65JLIR',
|
||||
'vMNaMp3kk7UzoFdOrKECQ0dbGQQFdsg21jdBVQN2rma1+8IL4BIgc+VolnIT0Pq8',
|
||||
'XAAeOjD0z4rgosZ/wZx4lVQuhW9Aut9QoR/ectc9sB3vR6mSVTJejZpzf8X0Hrii',
|
||||
'uYsIaHmT4fAl0ij4eShI1eVsWldMYxNfzPpOPLfU2VHwDx8ibD3WMRU2pEmleGV9',
|
||||
'tboMKq3raqar1syVXaDT0toiBHIAbToL3q0hWvWYWwHUiGnd4a4XgmvUgRxgtnTo',
|
||||
'6xEqKoWToYAAdn6496acd84T39bN4l+3aN7P+u+vTqljucfgUmqBdKltzk5GePFP',
|
||||
'XptDV3keIcKoP6Pzzju9MWWIYTu7y8SR1NHeKLoGpece3weoD0D/jk+WYTiBH14k',
|
||||
't7hCnfvsvw1cartYn5AWYBJ7t45dQ8ZfYl2sEFHmFYfKoK8capU1ueTYHrez5MIK',
|
||||
'Uc0gm1yDPGZN6Uf67orr2e3uT8WEEo8unjmtN5KDij7EoujVsJ+A3aSZjCgsHr2o',
|
||||
'93iyrJp/7yNMEFBjefmMcE0hrXLxz9S7MDDyzy76NS2/8hZ59wfD5EK2yvm0fe2n',
|
||||
'DGB+coGb05RUAgMwra3SJdhS7jd3vz8ymrgiu6L9qchwE55aiZW/bQJeKXkJxuIB',
|
||||
'9WFRd+WrHOHPwv9Bop1nvRrVHZLXqoC0BoalUcyntHxKYeyucNYCTOW0DnBMI+kL',
|
||||
'CmXfroMjzGD13xTvFYeHxVOWHZqTdU0DU42DPXDDrRuNnbZgSVNNGxQDysaeIS9f',
|
||||
'3+8cWfdMQk1rAxzJeqqnXtakxCyO8BzJMxobuJ89iE+WC8kho3nl/MSe8LnBU2/3',
|
||||
'7yTjl7ChG37y4vlnrTGMtMiaZNDpP6u3JY9/L1kHAOGJ0vFXmwnvDf2orAc2wh9r',
|
||||
'QJolJqUQ3z4c/ACD69AuuNWk+USC386IDxdHkRH+c8exN9zPG35qGkmWoH9T+lZk',
|
||||
'CNC/LrvBJKuYAwl+XyVb2gEITERT3jr9TO3rkE/1fdRVemeK5gPLW13b7cKtwnq6',
|
||||
'q/Un8XNxP6KeTW51A91dL71l60TMW/owYtMeOJ1140bG2KrQWeuojnNvk4V6nxlZ',
|
||||
'uwg+a87IyedsWKX8gRtpUcAqV3yt2l4XGyAag7e50EZnkDIm5TPGgds1jLItAYcb',
|
||||
'CmUl4iVP5QxkFdgKQXr3AsV5kWAi/WegDfaj/7FBu5ffosF8YdyhohOY5amxYC2y',
|
||||
'dw3VdkfgZohyHZs76T7sheQwtIzVNEYhK/9H/tr4OK13qRHlS7FcdZ+cw+t/Sj9b',
|
||||
'tRaBi2+IFTBtJg2th50pYieZx58Lrly5o70K/WgnqQyJEEgKxqb77a3MC73AFku6',
|
||||
'j5Krk4atOku6d4kEcgQYAQgAJhYhBAAvG9GBGMC2VXKUbyCpfMhgpjCTBQJbbbEe',
|
||||
'AhsCBQkB4TOAAkA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00xfsO090OMGAVI/+v7+A4NMzCnJF9tWLF2ykfZhMRLfPvyr9880yWZOBRf',
|
||||
'iuotS7oP+LIPfoq2txWNXfjDHvnQDTIHLhoM2HMdzI5qMkLax1bcgGT2uuogA+JI',
|
||||
'bQ+9gO7VoqHi1qWb7MPzyaTk4Wxl9oP9qYo28m4xrgJ+bPz/cCgeY8Li4L8ds9cb',
|
||||
'Q69OJhPncMYjrWx7dtB5AP9zdYaYjHejuSgI9s0J9Zum8QrCI/HdPZLIVIuuHywd',
|
||||
'b77w5v0a+vXw7qCBXpEPEsRbExn6FjC2bGunbdAw5S+MTZSkTpCJUHoxKIxFiOUe',
|
||||
'7F6lEBizbbSpIIRZMcwqB9gMxtRE2JrNntSVpHiBXKMSRXh/416hG7Gwf2hxppPw',
|
||||
'hBr9NrB2VFHtdaWf2YqBGb7c1xusmEuGLcGUqFGCXo/g/lOSPijea91puCf9bgKy',
|
||||
'0P7n+O0V3W1QpkI4ne5TE2vBFUFo9K5IFe4qBI1JPjbLTfOI2lojx8P12+lqWug=',
|
||||
'=NbaL',
|
||||
'-----END PGP PRIVATE KEY BLOCK-----'
|
||||
].join("\n");
|
||||
|
||||
const signature_with_critical_notation = `-----BEGIN PGP MESSAGE-----
|
||||
|
||||
|
@ -832,7 +837,7 @@ vwjE8mqJXetNMfj8r2SCyvkEnlVRYR+/mnge+ib56FdJ8uKtqSxyvgA=
|
|||
=fRXs
|
||||
-----END PGP MESSAGE-----`;
|
||||
|
||||
const signature_with_non_human_readable_notations = `-----BEGIN PGP SIGNATURE-----
|
||||
const signature_with_non_human_readable_notations = `-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
wncEARYKAB8FAl2TS9MYFAAAAAAADAADdGVzdEBrZXkuY29tAQIDAAoJEGZ9
|
||||
gtV/iL8hrhMBAOQ/UgqRTbx1Z8inGmRdUx1cJU1SR4Pnq/eJNH/CFk5DAP0Q
|
||||
|
@ -1449,7 +1454,7 @@ hkJiXopCSWKSlQInL1devkJJUWJmTmZeugJYlpdLAagQJM0JpsCqIQZwKgAA
|
|||
const pubKey = await openpgp.readArmoredKey(pub_key_arm2);
|
||||
const privKey = await openpgp.readArmoredKey(priv_key_arm2);
|
||||
await privKey.decrypt('hello world');
|
||||
return openpgp.sign({ privateKeys:[privKey], message: openpgp.Message.fromText(plaintext), detached: true}).then(async function(signed) {
|
||||
return openpgp.sign({ privateKeys:[privKey], message: openpgp.Message.fromText(plaintext), detached: true }).then(async function(signed) {
|
||||
const signature = await openpgp.readArmoredSignature(signed);
|
||||
return openpgp.verify({ publicKeys:[pubKey], message: openpgp.Message.fromBinary(util.encodeUtf8(plaintext)), signature: signature });
|
||||
}).then(function(cleartextSig) {
|
||||
|
@ -1466,7 +1471,7 @@ hkJiXopCSWKSlQInL1devkJJUWJmTmZeugJYlpdLAagQJM0JpsCqIQZwKgAA
|
|||
const pubKey = await openpgp.readArmoredKey(pub_key_arm2);
|
||||
const privKey = await openpgp.readArmoredKey(priv_key_arm2);
|
||||
await privKey.decrypt('hello world');
|
||||
return openpgp.sign({ privateKeys:[privKey], message:openpgp.Message.fromBinary(plaintextArray), detached: true}).then(async function(signed) {
|
||||
return openpgp.sign({ privateKeys:[privKey], message:openpgp.Message.fromBinary(plaintextArray), detached: true }).then(async function(signed) {
|
||||
const signature = await openpgp.readArmoredSignature(signed);
|
||||
return openpgp.verify({ publicKeys:[pubKey], message: openpgp.Message.fromText(plaintext), signature: signature });
|
||||
}).then(function(cleartextSig) {
|
||||
|
@ -1482,12 +1487,12 @@ hkJiXopCSWKSlQInL1devkJJUWJmTmZeugJYlpdLAagQJM0JpsCqIQZwKgAA
|
|||
const pubKey = await openpgp.readArmoredKey(pub_key_arm2);
|
||||
const privKey = await openpgp.readArmoredKey(priv_key_arm2);
|
||||
await Promise.all([privKey.primaryKey.decrypt('hello world'), privKey.subKeys[0].keyPacket.decrypt('hello world')]);
|
||||
return openpgp.sign({ privateKeys:[privKey], message: openpgp.Message.fromText(plaintext), detached: true}).then(async function(signed) {
|
||||
return openpgp.sign({ privateKeys:[privKey], message: openpgp.Message.fromText(plaintext), detached: true }).then(async function(signed) {
|
||||
const signature = await openpgp.readArmoredSignature(signed);
|
||||
return openpgp.encrypt({ message: openpgp.Message.fromBinary(util.encodeUtf8(plaintext)), publicKeys: [pubKey], signature })
|
||||
return openpgp.encrypt({ message: openpgp.Message.fromBinary(util.encodeUtf8(plaintext)), publicKeys: [pubKey], signature });
|
||||
}).then(async data => {
|
||||
const csMsg = await openpgp.readArmoredMessage(data);
|
||||
return openpgp.decrypt({ message: csMsg, privateKeys: [ privKey ], publicKeys: [ pubKey ] });
|
||||
return openpgp.decrypt({ message: csMsg, privateKeys: [privKey], publicKeys: [pubKey] });
|
||||
}).then(function(cleartextSig) {
|
||||
expect(cleartextSig).to.exist;
|
||||
expect(cleartextSig.signatures).to.have.length(1);
|
||||
|
@ -1543,7 +1548,7 @@ hkJiXopCSWKSlQInL1devkJJUWJmTmZeugJYlpdLAagQJM0JpsCqIQZwKgAA
|
|||
|
||||
expect(pubKey).to.exist;
|
||||
expect(pubKey.users[0].selfCertifications[0].keyNeverExpires).to.be.false;
|
||||
expect(pubKey.users[0].selfCertifications[0].keyExpirationTime).to.equal(5*365*24*60*60);
|
||||
expect(pubKey.users[0].selfCertifications[0].keyExpirationTime).to.equal(5 * 365 * 24 * 60 * 60);
|
||||
});
|
||||
|
||||
it('Write unhashed subpackets', async function() {
|
||||
|
@ -1697,9 +1702,9 @@ iTuGu4fEU1UligAXSrZmCdE=
|
|||
-----END PGP PUBLIC KEY BLOCK-----`;
|
||||
|
||||
const key = await openpgp.readArmoredKey(armoredKeyWithPhoto);
|
||||
for (const user of key.users) {
|
||||
await Promise.all(key.users.map(async user => {
|
||||
await user.verify(key.primaryKey);
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
it('should verify a shorter RSA signature', async function () {
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/* eslint-disable max-lines */
|
||||
/* globals tryTests: true */
|
||||
|
||||
const openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../..');
|
||||
const random = require('../../src/crypto/random');
|
||||
const util = require('../../src/util');
|
||||
|
@ -11,11 +14,11 @@ const { expect } = chai;
|
|||
|
||||
const { stream } = openpgp;
|
||||
|
||||
const useNativeStream = (() => { try { new global.ReadableStream(); return true; } catch (e) { return false; } })();
|
||||
const useNativeStream = (() => { try { new global.ReadableStream(); return true; } catch (e) { return false; } })(); // eslint-disable-line no-new
|
||||
const ReadableStream = useNativeStream ? global.ReadableStream : openpgp.stream.ReadableStream;
|
||||
|
||||
const pub_key =
|
||||
['-----BEGIN PGP PUBLIC KEY BLOCK-----',
|
||||
const pub_key = [
|
||||
'-----BEGIN PGP PUBLIC KEY BLOCK-----',
|
||||
'Version: GnuPG v2.0.19 (GNU/Linux)',
|
||||
'',
|
||||
'mI0EUmEvTgEEANyWtQQMOybQ9JltDqmaX0WnNPJeLILIM36sw6zL0nfTQ5zXSS3+',
|
||||
|
@ -37,10 +40,11 @@ const pub_key =
|
|||
'AtNTq6ihLMD5v1d82ZC7tNatdlDMGWnIdvEMCv2GZcuIqDQ9rXWs49e7tq1NncLY',
|
||||
'hz3tYjKhoFTKEIq3y3Pp',
|
||||
'=h/aX',
|
||||
'-----END PGP PUBLIC KEY BLOCK-----'].join('\n');
|
||||
'-----END PGP PUBLIC KEY BLOCK-----'
|
||||
].join('\n');
|
||||
|
||||
const priv_key =
|
||||
['-----BEGIN PGP PRIVATE KEY BLOCK-----',
|
||||
const priv_key = [
|
||||
'-----BEGIN PGP PRIVATE KEY BLOCK-----',
|
||||
'Version: GnuPG v2.0.19 (GNU/Linux)',
|
||||
'',
|
||||
'lQH+BFJhL04BBADclrUEDDsm0PSZbQ6pml9FpzTyXiyCyDN+rMOsy9J300Oc10kt',
|
||||
|
@ -77,7 +81,8 @@ const priv_key =
|
|||
'SXuqKcWqoEuO7OBSEFThCXBfUYMC01OrqKEswPm/V3zZkLu01q12UMwZach28QwK',
|
||||
'/YZly4ioND2tdazj17u2rU2dwtiHPe1iMqGgVMoQirfLc+k=',
|
||||
'=lw5e',
|
||||
'-----END PGP PRIVATE KEY BLOCK-----'].join('\n');
|
||||
'-----END PGP PRIVATE KEY BLOCK-----'
|
||||
].join('\n');
|
||||
|
||||
const passphrase = 'hello world';
|
||||
|
||||
|
@ -99,31 +104,31 @@ const brainpoolPub = [
|
|||
'oml1QWkiI6BtbLD39Su6zQKR7u+Y',
|
||||
'=wB7z',
|
||||
'-----END PGP PUBLIC KEY BLOCK-----'
|
||||
].join('\n');
|
||||
].join('\n');
|
||||
|
||||
const brainpoolPriv = [
|
||||
'-----BEGIN PGP PRIVATE KEY BLOCK-----',
|
||||
'',
|
||||
'lNYEWq8ruRMJKyQDAwIIAQELAwMEhi/66JLo1vMhpytb1bYvBhd/aKHde2Zwke7r',
|
||||
'zWFTYBZQl/DUrpMrVAhkQhk5G3kqFWf98O/DpvVmY6EDr3IjmODWowNvGfC4Avc9',
|
||||
'rYRgV8GbMBUVLIS+ytS1YNpAKW4v/gcDAtyjmSfDquSq5ffphtkwJ56Zz5jc+jSm',
|
||||
'yZaPgmnPOwcgYhWy1g7BcBKYFPNKZlajnV4Rut2VUWkELwWrRmchX4ENJoAKZob0',
|
||||
'l/zjgOPug3FtEGirOPmvi7nOkjDEFNJwtBlidW5ueSA8YnVubnlAYnVubnkuYnVu',
|
||||
'bnk+iLAEExMKADgWIQSLliWLcmzBLxv2/X36PWTJvPM4vAUCWq8ruQIbAwULCQgH',
|
||||
'AwUVCgkICwUWAgMBAAIeAQIXgAAKCRD6PWTJvPM4vIcVAYCIO41QylZkb9W4FP+k',
|
||||
'd3bzb73xxwojWpCiw1bWV9Xe/dKA23DtCYhlmhF/Twjh9lkBfihHXs/negGMnqbA',
|
||||
'8TQFU1IvBflDcA7yj677lgLkze/yd5hg/ZVx7M8XyUzcEm9xi5zaBFqvK7kSCSsk',
|
||||
'AwMCCAEBCwMDBCkGskA01sBvG/B1bl0EN+yxF6xPn74WQoAMm7K4n1PlZ1u8RWg+',
|
||||
'BJVGKna/88ZGcT5BZSUvRrYWgqb4/SPAPea5C1p6UYd+C0C0dVf0FaGv5z0gCtc/',
|
||||
'+kwF3sLGLZh3rAMBCQn+BwMC6RvzFHWyKqPlVqrm6+j797Y9vHdZW1zixtmEK0Wg',
|
||||
'lvQRpZF8AbpSzk/XolsoeQyic1e18C6ubFZFw7cI7ekINiRu/OXOvBnTbc5TdbDi',
|
||||
'kKTuOkL+lEwWrUTEwdshbJ+ImAQYEwoAIBYhBIuWJYtybMEvG/b9ffo9ZMm88zi8',
|
||||
'BQJaryu5AhsMAAoJEPo9ZMm88zi8w1QBfR4k1d5ElME3ef7viE+Mud4qGv1ra56p',
|
||||
'Ka86hS9+l262twTxe1hk08/FySeJW08P3wF/WrhCrE9UDD6FQiZk1lqekhd9bf84',
|
||||
'v6i5Smbioml1QWkiI6BtbLD39Su6zQKR7u+Y',
|
||||
'=uGZP',
|
||||
'-----END PGP PRIVATE KEY BLOCK-----'
|
||||
].join('\n');
|
||||
'-----BEGIN PGP PRIVATE KEY BLOCK-----',
|
||||
'',
|
||||
'lNYEWq8ruRMJKyQDAwIIAQELAwMEhi/66JLo1vMhpytb1bYvBhd/aKHde2Zwke7r',
|
||||
'zWFTYBZQl/DUrpMrVAhkQhk5G3kqFWf98O/DpvVmY6EDr3IjmODWowNvGfC4Avc9',
|
||||
'rYRgV8GbMBUVLIS+ytS1YNpAKW4v/gcDAtyjmSfDquSq5ffphtkwJ56Zz5jc+jSm',
|
||||
'yZaPgmnPOwcgYhWy1g7BcBKYFPNKZlajnV4Rut2VUWkELwWrRmchX4ENJoAKZob0',
|
||||
'l/zjgOPug3FtEGirOPmvi7nOkjDEFNJwtBlidW5ueSA8YnVubnlAYnVubnkuYnVu',
|
||||
'bnk+iLAEExMKADgWIQSLliWLcmzBLxv2/X36PWTJvPM4vAUCWq8ruQIbAwULCQgH',
|
||||
'AwUVCgkICwUWAgMBAAIeAQIXgAAKCRD6PWTJvPM4vIcVAYCIO41QylZkb9W4FP+k',
|
||||
'd3bzb73xxwojWpCiw1bWV9Xe/dKA23DtCYhlmhF/Twjh9lkBfihHXs/negGMnqbA',
|
||||
'8TQFU1IvBflDcA7yj677lgLkze/yd5hg/ZVx7M8XyUzcEm9xi5zaBFqvK7kSCSsk',
|
||||
'AwMCCAEBCwMDBCkGskA01sBvG/B1bl0EN+yxF6xPn74WQoAMm7K4n1PlZ1u8RWg+',
|
||||
'BJVGKna/88ZGcT5BZSUvRrYWgqb4/SPAPea5C1p6UYd+C0C0dVf0FaGv5z0gCtc/',
|
||||
'+kwF3sLGLZh3rAMBCQn+BwMC6RvzFHWyKqPlVqrm6+j797Y9vHdZW1zixtmEK0Wg',
|
||||
'lvQRpZF8AbpSzk/XolsoeQyic1e18C6ubFZFw7cI7ekINiRu/OXOvBnTbc5TdbDi',
|
||||
'kKTuOkL+lEwWrUTEwdshbJ+ImAQYEwoAIBYhBIuWJYtybMEvG/b9ffo9ZMm88zi8',
|
||||
'BQJaryu5AhsMAAoJEPo9ZMm88zi8w1QBfR4k1d5ElME3ef7viE+Mud4qGv1ra56p',
|
||||
'Ka86hS9+l262twTxe1hk08/FySeJW08P3wF/WrhCrE9UDD6FQiZk1lqekhd9bf84',
|
||||
'v6i5Smbioml1QWkiI6BtbLD39Su6zQKR7u+Y',
|
||||
'=uGZP',
|
||||
'-----END PGP PRIVATE KEY BLOCK-----'
|
||||
].join('\n');
|
||||
|
||||
const brainpoolPass = '321';
|
||||
|
||||
|
@ -165,7 +170,14 @@ const xPriv = [
|
|||
const xPass = 'sun';
|
||||
|
||||
|
||||
let privKey, pubKey, plaintext, data, i, canceled, expectedType, dataArrived;
|
||||
let privKey;
|
||||
let pubKey;
|
||||
let plaintext;
|
||||
let data;
|
||||
let i;
|
||||
let canceled;
|
||||
let expectedType;
|
||||
let dataArrived;
|
||||
|
||||
function tests() {
|
||||
it('Encrypt small message', async function() {
|
||||
|
@ -179,7 +191,7 @@ function tests() {
|
|||
});
|
||||
const encrypted = await openpgp.encrypt({
|
||||
message: openpgp.Message.fromBinary(data),
|
||||
passwords: ['test'],
|
||||
passwords: ['test']
|
||||
});
|
||||
const msgAsciiArmored = await openpgp.stream.readToEnd(encrypted);
|
||||
const message = await openpgp.readArmoredMessage(msgAsciiArmored);
|
||||
|
@ -193,7 +205,7 @@ function tests() {
|
|||
it('Encrypt larger message', async function() {
|
||||
const encrypted = await openpgp.encrypt({
|
||||
message: openpgp.Message.fromBinary(data),
|
||||
passwords: ['test'],
|
||||
passwords: ['test']
|
||||
});
|
||||
const reader = openpgp.stream.getReader(encrypted);
|
||||
expect(await reader.peekBytes(1024)).to.match(/^-----BEGIN PGP MESSAGE-----\n/);
|
||||
|
@ -212,7 +224,7 @@ function tests() {
|
|||
it('Input stream should be canceled when canceling encrypted stream', async function() {
|
||||
const encrypted = await openpgp.encrypt({
|
||||
message: openpgp.Message.fromBinary(data),
|
||||
passwords: ['test'],
|
||||
passwords: ['test']
|
||||
});
|
||||
const reader = openpgp.stream.getReader(encrypted);
|
||||
expect(await reader.readBytes(1024)).to.match(/^-----BEGIN PGP MESSAGE-----\n/);
|
||||
|
@ -236,7 +248,7 @@ function tests() {
|
|||
});
|
||||
|
||||
it('Encrypt and decrypt larger message roundtrip', async function() {
|
||||
let aeadProtectValue = openpgp.config.aeadProtect;
|
||||
const aeadProtectValue = openpgp.config.aeadProtect;
|
||||
openpgp.config.aeadProtect = false;
|
||||
const encrypted = await openpgp.encrypt({
|
||||
message: openpgp.Message.fromBinary(data),
|
||||
|
@ -261,8 +273,8 @@ function tests() {
|
|||
});
|
||||
|
||||
it('Encrypt and decrypt larger message roundtrip (allowUnauthenticatedStream=true)', async function() {
|
||||
let aeadProtectValue = openpgp.config.aeadProtect;
|
||||
let allowUnauthenticatedStreamValue = openpgp.config.allowUnauthenticatedStream;
|
||||
const aeadProtectValue = openpgp.config.aeadProtect;
|
||||
const allowUnauthenticatedStreamValue = openpgp.config.allowUnauthenticatedStream;
|
||||
openpgp.config.aeadProtect = false;
|
||||
openpgp.config.allowUnauthenticatedStream = true;
|
||||
try {
|
||||
|
@ -293,7 +305,7 @@ function tests() {
|
|||
});
|
||||
|
||||
it('Encrypt and decrypt larger message roundtrip using public keys (allowUnauthenticatedStream=true)', async function() {
|
||||
let allowUnauthenticatedStreamValue = openpgp.config.allowUnauthenticatedStream;
|
||||
const allowUnauthenticatedStreamValue = openpgp.config.allowUnauthenticatedStream;
|
||||
openpgp.config.allowUnauthenticatedStream = true;
|
||||
try {
|
||||
const encrypted = await openpgp.encrypt({
|
||||
|
@ -322,7 +334,7 @@ function tests() {
|
|||
});
|
||||
|
||||
it('Encrypt and decrypt larger message roundtrip using curve x25519 (allowUnauthenticatedStream=true)', async function() {
|
||||
let allowUnauthenticatedStreamValue = openpgp.config.allowUnauthenticatedStream;
|
||||
const allowUnauthenticatedStreamValue = openpgp.config.allowUnauthenticatedStream;
|
||||
openpgp.config.allowUnauthenticatedStream = true;
|
||||
const priv = await openpgp.readArmoredKey(xPriv);
|
||||
const pub = await openpgp.readArmoredKey(xPub);
|
||||
|
@ -354,7 +366,7 @@ function tests() {
|
|||
});
|
||||
|
||||
it('Encrypt and decrypt larger message roundtrip using curve brainpool (allowUnauthenticatedStream=true)', async function() {
|
||||
let allowUnauthenticatedStreamValue = openpgp.config.allowUnauthenticatedStream;
|
||||
const allowUnauthenticatedStreamValue = openpgp.config.allowUnauthenticatedStream;
|
||||
openpgp.config.allowUnauthenticatedStream = true;
|
||||
const priv = await openpgp.readArmoredKey(brainpoolPriv);
|
||||
const pub = await openpgp.readArmoredKey(brainpoolPub);
|
||||
|
@ -386,9 +398,9 @@ function tests() {
|
|||
});
|
||||
|
||||
it('Detect MDC modifications (allowUnauthenticatedStream=true)', async function() {
|
||||
let aeadProtectValue = openpgp.config.aeadProtect;
|
||||
const aeadProtectValue = openpgp.config.aeadProtect;
|
||||
openpgp.config.aeadProtect = false;
|
||||
let allowUnauthenticatedStreamValue = openpgp.config.allowUnauthenticatedStream;
|
||||
const allowUnauthenticatedStreamValue = openpgp.config.allowUnauthenticatedStream;
|
||||
openpgp.config.allowUnauthenticatedStream = true;
|
||||
try {
|
||||
const encrypted = await openpgp.encrypt({
|
||||
|
@ -423,7 +435,7 @@ function tests() {
|
|||
});
|
||||
|
||||
it('Detect armor checksum error (allowUnauthenticatedStream=true)', async function() {
|
||||
let allowUnauthenticatedStreamValue = openpgp.config.allowUnauthenticatedStream;
|
||||
const allowUnauthenticatedStreamValue = openpgp.config.allowUnauthenticatedStream;
|
||||
openpgp.config.allowUnauthenticatedStream = true;
|
||||
try {
|
||||
const encrypted = await openpgp.encrypt({
|
||||
|
@ -458,7 +470,7 @@ function tests() {
|
|||
});
|
||||
|
||||
it('Detect armor checksum error when not passing public keys (allowUnauthenticatedStream=true)', async function() {
|
||||
let allowUnauthenticatedStreamValue = openpgp.config.allowUnauthenticatedStream;
|
||||
const allowUnauthenticatedStreamValue = openpgp.config.allowUnauthenticatedStream;
|
||||
openpgp.config.allowUnauthenticatedStream = true;
|
||||
try {
|
||||
const encrypted = await openpgp.encrypt({
|
||||
|
@ -802,13 +814,13 @@ function tests() {
|
|||
it('Encrypt and decrypt larger text message roundtrip (AEAD)', async function() {
|
||||
openpgp.config.aeadChunkSizeByte = 0;
|
||||
|
||||
let plaintext = [];
|
||||
const plaintext = [];
|
||||
let i = 0;
|
||||
const data = new ReadableStream({
|
||||
async pull(controller) {
|
||||
await new Promise(resolve => setTimeout(resolve, 10));
|
||||
if (i++ < 10) {
|
||||
let randomData = input.createSomeMessage();
|
||||
const randomData = input.createSomeMessage();
|
||||
controller.enqueue(randomData);
|
||||
plaintext.push(randomData);
|
||||
} else {
|
||||
|
@ -875,7 +887,7 @@ function tests() {
|
|||
it('Input stream should be canceled when canceling decrypted stream (AEAD)', async function() {
|
||||
const encrypted = await openpgp.encrypt({
|
||||
message: openpgp.Message.fromBinary(data),
|
||||
passwords: ['test'],
|
||||
passwords: ['test']
|
||||
});
|
||||
|
||||
const message = await openpgp.readArmoredMessage(encrypted);
|
||||
|
@ -905,9 +917,9 @@ module.exports = () => describe('Streaming', function() {
|
|||
});
|
||||
|
||||
beforeEach(function() {
|
||||
let test = ++currentTest;
|
||||
const test = ++currentTest;
|
||||
|
||||
let dataArrivedPromise = new Promise(resolve => {
|
||||
const dataArrivedPromise = new Promise(resolve => {
|
||||
dataArrived = resolve;
|
||||
});
|
||||
plaintext = [];
|
||||
|
@ -918,7 +930,7 @@ module.exports = () => describe('Streaming', function() {
|
|||
await new Promise(setTimeout);
|
||||
if (test === currentTest && i++ < 100) {
|
||||
if (i === 4) await dataArrivedPromise;
|
||||
let randomBytes = await random.getRandomBytes(1024);
|
||||
const randomBytes = await random.getRandomBytes(1024);
|
||||
controller.enqueue(randomBytes);
|
||||
plaintext.push(randomBytes);
|
||||
} else {
|
||||
|
@ -951,7 +963,7 @@ module.exports = () => describe('Streaming', function() {
|
|||
|
||||
it('Node: Encrypt and decrypt text message roundtrip', async function() {
|
||||
dataArrived(); // Do not wait until data arrived.
|
||||
const plaintext = fs.readFileSync(__filename.replace('streaming.js', 'openpgp.js'), 'utf8');
|
||||
const plaintext = fs.readFileSync(__filename.replace('streaming.js', 'openpgp.js'), 'utf8'); // eslint-disable-line no-sync
|
||||
const data = fs.createReadStream(__filename.replace('streaming.js', 'openpgp.js'), { encoding: 'utf8' });
|
||||
const encrypted = await openpgp.encrypt({
|
||||
message: openpgp.Message.fromText(data),
|
||||
|
@ -970,7 +982,7 @@ module.exports = () => describe('Streaming', function() {
|
|||
|
||||
it('Node: Encrypt and decrypt binary message roundtrip', async function() {
|
||||
dataArrived(); // Do not wait until data arrived.
|
||||
const plaintext = fs.readFileSync(__filename.replace('streaming.js', 'openpgp.js'));
|
||||
const plaintext = fs.readFileSync(__filename.replace('streaming.js', 'openpgp.js')); // eslint-disable-line no-sync
|
||||
const data = fs.createReadStream(__filename.replace('streaming.js', 'openpgp.js'));
|
||||
const encrypted = await openpgp.encrypt({
|
||||
message: openpgp.Message.fromBinary(data),
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
const openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../..');
|
||||
const util = require('../../src/util');
|
||||
|
||||
const chai = require('chai');
|
||||
|
@ -42,7 +41,7 @@ module.exports = () => describe('Util unit tests', function() {
|
|||
expect(util.isArray(data)).to.be.true;
|
||||
});
|
||||
it('should return true for type Array', function() {
|
||||
const data = Array();
|
||||
const data = Array(); // eslint-disable-line no-array-constructor
|
||||
expect(util.isArray(data)).to.be.true;
|
||||
});
|
||||
it('should return true for inherited type of Array', function() {
|
||||
|
@ -144,8 +143,8 @@ module.exports = () => describe('Util unit tests', function() {
|
|||
|
||||
describe("Misc.", function() {
|
||||
it('util.readNumber should not overflow until full range of uint32', function () {
|
||||
const ints = [Math.pow(2, 20), Math.pow(2, 25), Math.pow(2, 30), Math.pow(2, 32) - 1];
|
||||
for(let i = 0; i < ints.length; i++) {
|
||||
const ints = [2 ** 20, 2 ** 25, 2 ** 30, 2 ** 32 - 1];
|
||||
for (let i = 0; i < ints.length; i++) {
|
||||
expect(util.readNumber(util.writeNumber(ints[i], 4))).to.equal(ints[i]);
|
||||
}
|
||||
});
|
||||
|
@ -155,7 +154,7 @@ module.exports = () => describe('Util unit tests', function() {
|
|||
it('util.encodeZBase32 encodes correctly', function() {
|
||||
const encoded = util.encodeZBase32(util.strToUint8Array('test-wkd'));
|
||||
expect(encoded).to.equal('qt1zg7bpq7ise');
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -4,6 +4,7 @@ const chai = require('chai');
|
|||
|
||||
const { expect } = chai;
|
||||
|
||||
/* eslint-disable no-invalid-this */
|
||||
module.exports = () => describe.skip('WKD unit tests', function() {
|
||||
this.timeout(60000);
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ module.exports = () => (openpgp.config.ci ? describe.skip : describe)('X25519 Cr
|
|||
const name = 'light';
|
||||
const randomData = input.createSomeMessage();
|
||||
const priv = await load_priv_key(name);
|
||||
const signed = await openpgp.sign({ privateKeys: [priv], message: openpgp.CleartextMessage.fromText(randomData)});
|
||||
const signed = await openpgp.sign({ privateKeys: [priv], message: openpgp.CleartextMessage.fromText(randomData) });
|
||||
const pub = await load_pub_key(name);
|
||||
const msg = await openpgp.readArmoredCleartextMessage(signed);
|
||||
const result = await openpgp.verify({ publicKeys: [pub], message: msg });
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable no-process-env */
|
||||
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
|
||||
|
@ -36,13 +38,13 @@ module.exports = function(config) {
|
|||
{
|
||||
pattern: 'test/**/*',
|
||||
included: false
|
||||
},
|
||||
}
|
||||
],
|
||||
|
||||
proxies: {
|
||||
'/lib': '/base/test/lib',
|
||||
'/worker': '/base/test/worker',
|
||||
'/dist': '/base/dist',
|
||||
'/dist': '/base/dist'
|
||||
},
|
||||
|
||||
// list of files to exclude
|
||||
|
@ -109,7 +111,7 @@ module.exports = function(config) {
|
|||
real_mobile: true,
|
||||
os: 'ios',
|
||||
os_version: '12'
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
captureTimeout: 6e5,
|
||||
|
@ -124,7 +126,7 @@ module.exports = function(config) {
|
|||
'bs_firefox_68',
|
||||
'bs_chrome_68',
|
||||
'bs_safari_11_1',
|
||||
'bs_ios_12',
|
||||
'bs_ios_12'
|
||||
],
|
||||
|
||||
// Continuous Integration mode
|
||||
|
|
|
@ -68,7 +68,7 @@ fhGyl7nA7UCwgsqf7ZPBhRg=
|
|||
=nbjQ
|
||||
-----END PGP SIGNATURE-----`;
|
||||
async function getOtherPubKey() {
|
||||
return await readArmoredKey(OTHERPUBKEY);
|
||||
return readArmoredKey(OTHERPUBKEY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
const openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../..');
|
||||
|
||||
const { key, cleartext, enums, PacketList, SignaturePacket } = openpgp;
|
||||
|
||||
const chai = require('chai');
|
||||
chai.use(require('chai-as-promised'));
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ Dc2vwS83Aja9iWrIEg==
|
|||
-----END PGP PRIVATE KEY BLOCK-----`;
|
||||
|
||||
async function getInvalidKey() {
|
||||
return await readArmoredKey(INVALID_KEY);
|
||||
return readArmoredKey(INVALID_KEY);
|
||||
}
|
||||
async function makeKeyValid() {
|
||||
/**
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* globals openpgp: true */
|
||||
|
||||
(typeof window !== 'undefined' ? window : global).globalThis = (typeof window !== 'undefined' ? window : global);
|
||||
|
||||
(typeof window !== 'undefined' ? window : global).resolves = function(val) {
|
||||
|
@ -34,7 +36,7 @@ describe('Unit Tests', function () {
|
|||
if (key && key !== 'grep') {
|
||||
openpgp.config[key] = decodeURIComponent(value);
|
||||
try {
|
||||
openpgp.config[key] = window.eval(openpgp.config[key]);
|
||||
openpgp.config[key] = window.eval(openpgp.config[key]); // eslint-disable-line no-eval
|
||||
} catch (e) {}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -18,7 +18,7 @@ function tests() {
|
|||
try {
|
||||
globalThis.eval('(async function() {})');
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
console.error(e); // eslint-disable-line no-console
|
||||
this.skip();
|
||||
}
|
||||
const worker = new Worker('./worker/worker_example.js');
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* globals openpgp: true */
|
||||
|
||||
importScripts('../../dist/openpgp.js');
|
||||
|
||||
const publicKeyArmored = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
@ -71,7 +73,7 @@ onmessage = async function({ data: { action, message }, ports: [port] }) {
|
|||
}
|
||||
port.postMessage({ result });
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
console.error(e); // eslint-disable-line no-console
|
||||
port.postMessage({ error: e.message });
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user