
Also, fix keyFlags of signing subkeys. Also, store Issuer Key ID and Embedded Signature in unhashed rather than hashed subpackets.
409 lines
18 KiB
JavaScript
409 lines
18 KiB
JavaScript
const openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp');
|
|
|
|
const chai = require('chai');
|
|
|
|
const { expect } = chai;
|
|
|
|
describe("ASCII armor", function() {
|
|
|
|
function getArmor(headers, signatureHeaders) {
|
|
return ['-----BEGIN PGP SIGNED MESSAGE-----']
|
|
.concat(headers)
|
|
.concat(
|
|
['',
|
|
'sign this',
|
|
'-----BEGIN PGP SIGNATURE-----']
|
|
)
|
|
.concat(signatureHeaders || ['Version: GnuPG v2.0.22 (GNU/Linux)'])
|
|
.concat(
|
|
['',
|
|
'iJwEAQECAAYFAlMrPj0ACgkQ4IT3RGwgLJfYkQQAgHMQieazCVdfGAfzQM69Egm5',
|
|
'HhcQszODD898wpoGCHgiNdNo1+5nujQAtXnkcxM+Vf7onfbTvUqut/siyO3fzqhK',
|
|
'LQ9DiQUwJMBE8nOwVR7Mpc4kLNngMTNaHAjZaVaDpTCrklPY+TPHIZnu0B6Ur+6t',
|
|
'skTzzVXIxMYw8ihbHfk=',
|
|
'=e/eA',
|
|
'-----END PGP SIGNATURE-----']
|
|
).join('\n');
|
|
}
|
|
|
|
it('Parse cleartext signed message', async function () {
|
|
let msg = getArmor(['Hash: SHA1']);
|
|
msg = await openpgp.cleartext.readArmored(msg);
|
|
expect(msg).to.be.an.instanceof(openpgp.cleartext.CleartextMessage);
|
|
});
|
|
|
|
it('Exception if mismatch in armor header and signature', async function () {
|
|
let msg = getArmor(['Hash: SHA256']);
|
|
msg = openpgp.cleartext.readArmored(msg);
|
|
await expect(msg).to.be.rejectedWith(Error, /Hash algorithm mismatch in armor header and signature/);
|
|
});
|
|
|
|
it('Exception if no header and non-MD5 signature', async function () {
|
|
let msg = getArmor(null);
|
|
msg = openpgp.cleartext.readArmored(msg);
|
|
await expect(msg).to.be.rejectedWith(Error, /If no "Hash" header in cleartext signed message, then only MD5 signatures allowed/);
|
|
});
|
|
|
|
it('Exception if unknown hash algorithm', async function () {
|
|
let msg = getArmor(['Hash: LAV750']);
|
|
msg = openpgp.cleartext.readArmored(msg);
|
|
await expect(msg).to.be.rejectedWith(Error, /Unknown hash algorithm in armor header/);
|
|
});
|
|
|
|
it('Multiple hash values', async function () {
|
|
let msg = getArmor(['Hash: SHA1, SHA256']);
|
|
msg = await openpgp.cleartext.readArmored(msg);
|
|
expect(msg).to.be.an.instanceof(openpgp.cleartext.CleartextMessage);
|
|
});
|
|
|
|
it('Multiple hash header lines', async function () {
|
|
let msg = getArmor(['Hash: SHA1', 'Hash: SHA256']);
|
|
msg = await openpgp.cleartext.readArmored(msg);
|
|
expect(msg).to.be.an.instanceof(openpgp.cleartext.CleartextMessage);
|
|
});
|
|
|
|
it('Non-hash header line throws exception', async function () {
|
|
let msg = getArmor(['Hash: SHA1', 'Comment: could be anything']);
|
|
msg = openpgp.cleartext.readArmored(msg);
|
|
await expect(msg).to.be.rejectedWith(Error, /Only "Hash" header allowed in cleartext signed message/);
|
|
});
|
|
|
|
it('Multiple wrong hash values', async function () {
|
|
let msg = getArmor(['Hash: SHA512, SHA256']);
|
|
msg = openpgp.cleartext.readArmored(msg);
|
|
await expect(msg).to.be.rejectedWith(Error, /Hash algorithm mismatch in armor header and signature/);
|
|
});
|
|
|
|
it('Multiple wrong hash values', async function () {
|
|
let msg = getArmor(['Hash: SHA512, SHA256']);
|
|
msg = openpgp.cleartext.readArmored(msg);
|
|
await expect(msg).to.be.rejectedWith(Error, /Hash algorithm mismatch in armor header and signature/);
|
|
});
|
|
|
|
it('Filter whitespace in blank line', async function () {
|
|
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',
|
|
'-----BEGIN PGP SIGNATURE-----',
|
|
'Version: GnuPG v2.0.22 (GNU/Linux)',
|
|
'',
|
|
'iJwEAQECAAYFAlMrPj0ACgkQ4IT3RGwgLJfYkQQAgHMQieazCVdfGAfzQM69Egm5',
|
|
'HhcQszODD898wpoGCHgiNdNo1+5nujQAtXnkcxM+Vf7onfbTvUqut/siyO3fzqhK',
|
|
'LQ9DiQUwJMBE8nOwVR7Mpc4kLNngMTNaHAjZaVaDpTCrklPY+TPHIZnu0B6Ur+6t',
|
|
'skTzzVXIxMYw8ihbHfk=',
|
|
'=e/eA',
|
|
'-----END PGP SIGNATURE-----'].join('\n');
|
|
|
|
msg = await openpgp.cleartext.readArmored(msg);
|
|
expect(msg).to.be.an.instanceof(openpgp.cleartext.CleartextMessage);
|
|
});
|
|
|
|
it('Exception if improperly formatted armor header - plaintext section', async function () {
|
|
let msg = getArmor(['Hash:SHA256']);
|
|
msg = openpgp.cleartext.readArmored(msg);
|
|
await expect(msg).to.be.rejectedWith(Error, /Improperly formatted armor header/);
|
|
msg = getArmor(['Ha sh: SHA256']);
|
|
msg = openpgp.cleartext.readArmored(msg);
|
|
await expect(msg).to.be.rejectedWith(Error, /Only "Hash" header allowed in cleartext signed message/);
|
|
msg = getArmor(['Hash SHA256']);
|
|
msg = openpgp.cleartext.readArmored(msg);
|
|
await expect(msg).to.be.rejectedWith(Error, /Improperly formatted armor header/);
|
|
});
|
|
|
|
it('Exception if improperly formatted armor header - signature section', async function () {
|
|
await Promise.all(['Space : trailing', 'Space :switched', ': empty', 'none', 'Space:missing'].map(async function (invalidHeader) {
|
|
await expect(openpgp.cleartext.readArmored(getArmor(['Hash: SHA1'], [invalidHeader]))).to.be.rejectedWith(Error, /Improperly formatted armor header/);
|
|
}));
|
|
});
|
|
|
|
it('Ignore unknown armor header - signature section', async function () {
|
|
const validHeaders = ['Version: BCPG C# v1.7.4114.6375', 'Independent Reserve Pty. Ltd. 2017: 1.0.0.0'];
|
|
expect(await openpgp.cleartext.readArmored(getArmor(['Hash: SHA1'], validHeaders))).to.be.an.instanceof(openpgp.cleartext.CleartextMessage);
|
|
await Promise.all(['A: Hello', 'Ab: 1.2.3', 'Abcd: #!/yah', 'Acd 123 5.6.$.8: Hello', '_: Hello', '*: Hello', '* & ## ?? ()(): Hello', '( ): Weird'].map(async function (validHeader) {
|
|
expect(await openpgp.cleartext.readArmored(getArmor(['Hash: SHA1'], [validHeader]))).to.be.an.instanceof(openpgp.cleartext.CleartextMessage);
|
|
}));
|
|
});
|
|
|
|
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-----',
|
|
'',
|
|
'sign this',
|
|
'-----BEGIN PGP SIGNNATURE-----',
|
|
'Version: GnuPG v2.0.22 (GNU/Linux)',
|
|
'',
|
|
'iJwEAQECAAYFAlMrPj0ACgkQ4IT3RGwgLJfYkQQAgHMQieazCVdfGAfzQM69Egm5',
|
|
'HhcQszODD898wpoGCHgiNdNo1+5nujQAtXnkcxM+Vf7onfbTvUqut/siyO3fzqhK',
|
|
'LQ9DiQUwJMBE8nOwVR7Mpc4kLNngMTNaHAjZaVaDpTCrklPY+TPHIZnu0B6Ur+6t',
|
|
'skTzzVXIxMYw8ihbHfk=',
|
|
'=e/eA',
|
|
'-----END PGP SIGNNATURE-----'].join('\n');
|
|
|
|
msg = openpgp.cleartext.readArmored(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-----',
|
|
'Version: OpenPGP.js v0.3.0',
|
|
'Comment: https://openpgpjs.org',
|
|
'',
|
|
'xbYEUubX7gEBANDWhzoP+Tr/IyRSv++vl5jBesQIPTYGQBdzF4YDnGEBABEB',
|
|
'AAH+CQMIfzdw4/PKNl5gVXdtfDFdSIN8yJT2rbeg3+SsWexXZNNdRaONWaiB',
|
|
'Z5cG9Q6+BoXKsEshIdcYOgwsAgRxlPpRA34Vvmg2QBk7PhdrkbK7aqENsJ1w',
|
|
'dIlLD6p9GmLE20yVff58/fMiUtPRgsD83SpKTAX6EM1ulpkuQQNjmrVc5qc8',
|
|
'7AMdF80JdW5kZWZpbmVkwj8EEAEIABMFAlLm1+4JEBD8MASZrpALAhsDAAAs',
|
|
'QgD8CUrwv7Hrp/INR0/UvAvzS52VztREQwQWTJMrgTNHBGjHtgRS5tfuAQEA',
|
|
'nys9SaSgR+l6iZc/M8hGIUmbuahE2/+mtw+/l0RO+WcAEQEAAf4JAwjr39Yi',
|
|
'FzjxImDN1IoYVsonA9M+BtIIJHafuQUHjyEr1paJJK5xS6KlyGgpMTXTD6y/',
|
|
'qxS3ZSPPzHGRrs2CmkVEiPmurn9Ed05tb0y9OnJkWtuh3z9VVq9d8zHzuENa',
|
|
'bUfli+P/v+dRaZ+1rSOxUFbFYbFB5XK/A9b/OPFrv+mb4KrtLxugwj8EGAEI',
|
|
'ABMFAlLm1+4JEBD8MASZrpALAhsMAAC3IgD8DnLGbMnpLtrX72RCkPW1ffLq',
|
|
'71vlXMJNXvoCeuejiRw=',
|
|
'=wJN@',
|
|
'-----END PGP PRIVATE KEY BLOCK-----'].join('\n');
|
|
|
|
// try with default config
|
|
const result_1 = await openpgp.key.readArmored(privKey);
|
|
expect(result_1.err).to.exist;
|
|
expect(result_1.err[0].message).to.match(/Ascii armor integrity check on message failed/);
|
|
|
|
// try opposite config
|
|
openpgp.config.checksum_required = !openpgp.config.checksum_required;
|
|
const result_2 = await openpgp.key.readArmored(privKey);
|
|
expect(result_2.err).to.exist;
|
|
expect(result_2.err[0].message).to.match(/Ascii armor integrity check on message failed/);
|
|
|
|
// back to default
|
|
openpgp.config.checksum_required = !openpgp.config.checksum_required;
|
|
});
|
|
|
|
it('Armor checksum validation - valid', async function () {
|
|
const privKey =
|
|
['-----BEGIN PGP PRIVATE KEY BLOCK-----',
|
|
'Version: OpenPGP.js v0.3.0',
|
|
'Comment: https://openpgpjs.org',
|
|
'',
|
|
'xbYEUubX7gEBANDWhzoP+Tr/IyRSv++vl5jBesQIPTYGQBdzF4YDnGEBABEB',
|
|
'AAH+CQMIfzdw4/PKNl5gVXdtfDFdSIN8yJT2rbeg3+SsWexXZNNdRaONWaiB',
|
|
'Z5cG9Q6+BoXKsEshIdcYOgwsAgRxlPpRA34Vvmg2QBk7PhdrkbK7aqENsJ1w',
|
|
'dIlLD6p9GmLE20yVff58/fMiUtPRgsD83SpKTAX6EM1ulpkuQQNjmrVc5qc8',
|
|
'7AMdF80JdW5kZWZpbmVkwj8EEAEIABMFAlLm1+4JEBD8MASZrpALAhsDAAAs',
|
|
'QgD8CUrwv7Hrp/INR0/UvAvzS52VztREQwQWTJMrgTNHBGjHtgRS5tfuAQEA',
|
|
'nys9SaSgR+l6iZc/M8hGIUmbuahE2/+mtw+/l0RO+WcAEQEAAf4JAwjr39Yi',
|
|
'FzjxImDN1IoYVsonA9M+BtIIJHafuQUHjyEr1paJJK5xS6KlyGgpMTXTD6y/',
|
|
'qxS3ZSPPzHGRrs2CmkVEiPmurn9Ed05tb0y9OnJkWtuh3z9VVq9d8zHzuENa',
|
|
'bUfli+P/v+dRaZ+1rSOxUFbFYbFB5XK/A9b/OPFrv+mb4KrtLxugwj8EGAEI',
|
|
'ABMFAlLm1+4JEBD8MASZrpALAhsMAAC3IgD8DnLGbMnpLtrX72RCkPW1ffLq',
|
|
'71vlXMJNXvoCeuejiRw=',
|
|
'=wJNM',
|
|
'-----END PGP PRIVATE KEY BLOCK-----'].join('\n');
|
|
|
|
// try with default config
|
|
const result_1 = await openpgp.key.readArmored(privKey);
|
|
expect(result_1.err).to.not.exist;
|
|
|
|
// try opposite config
|
|
openpgp.config.checksum_required = !openpgp.config.checksum_required;
|
|
const result_2 = await openpgp.key.readArmored(privKey);
|
|
expect(result_2.err).to.not.exist;
|
|
|
|
// back to default
|
|
openpgp.config.checksum_required = !openpgp.config.checksum_required;
|
|
});
|
|
|
|
it('Armor checksum validation - missing', async function () {
|
|
const privKeyNoCheckSum =
|
|
['-----BEGIN PGP PRIVATE KEY BLOCK-----',
|
|
'Version: OpenPGP.js v0.3.0',
|
|
'Comment: https://openpgpjs.org',
|
|
'',
|
|
'xbYEUubX7gEBANDWhzoP+Tr/IyRSv++vl5jBesQIPTYGQBdzF4YDnGEBABEB',
|
|
'AAH+CQMIfzdw4/PKNl5gVXdtfDFdSIN8yJT2rbeg3+SsWexXZNNdRaONWaiB',
|
|
'Z5cG9Q6+BoXKsEshIdcYOgwsAgRxlPpRA34Vvmg2QBk7PhdrkbK7aqENsJ1w',
|
|
'dIlLD6p9GmLE20yVff58/fMiUtPRgsD83SpKTAX6EM1ulpkuQQNjmrVc5qc8',
|
|
'7AMdF80JdW5kZWZpbmVkwj8EEAEIABMFAlLm1+4JEBD8MASZrpALAhsDAAAs',
|
|
'QgD8CUrwv7Hrp/INR0/UvAvzS52VztREQwQWTJMrgTNHBGjHtgRS5tfuAQEA',
|
|
'nys9SaSgR+l6iZc/M8hGIUmbuahE2/+mtw+/l0RO+WcAEQEAAf4JAwjr39Yi',
|
|
'FzjxImDN1IoYVsonA9M+BtIIJHafuQUHjyEr1paJJK5xS6KlyGgpMTXTD6y/',
|
|
'qxS3ZSPPzHGRrs2CmkVEiPmurn9Ed05tb0y9OnJkWtuh3z9VVq9d8zHzuENa',
|
|
'bUfli+P/v+dRaZ+1rSOxUFbFYbFB5XK/A9b/OPFrv+mb4KrtLxugwj8EGAEI',
|
|
'ABMFAlLm1+4JEBD8MASZrpALAhsMAAC3IgD8DnLGbMnpLtrX72RCkPW1ffLq',
|
|
'71vlXMJNXvoCeuejiRw=',
|
|
'-----END PGP PRIVATE KEY BLOCK-----'].join('\n');
|
|
|
|
// try with default config
|
|
const result_1 = await openpgp.key.readArmored(privKeyNoCheckSum);
|
|
if(openpgp.config.checksum_required) {
|
|
expect(result_1.err).to.exist;
|
|
expect(result_1.err[0].message).to.match(/Ascii armor integrity check on message failed/);
|
|
} else {
|
|
expect(result_1.err).to.not.exist;
|
|
}
|
|
|
|
// try opposite config
|
|
openpgp.config.checksum_required = !openpgp.config.checksum_required;
|
|
const result_2 = await openpgp.key.readArmored(privKeyNoCheckSum);
|
|
if(openpgp.config.checksum_required) {
|
|
expect(result_2.err).to.exist;
|
|
expect(result_2.err[0].message).to.match(/Ascii armor integrity check on message failed/);
|
|
} else {
|
|
expect(result_2.err).to.not.exist;
|
|
}
|
|
|
|
// back to default
|
|
openpgp.config.checksum_required = !openpgp.config.checksum_required;
|
|
});
|
|
|
|
it('Armor checksum validation - missing - trailing newline', async function () {
|
|
const privKeyNoCheckSumWithTrailingNewline =
|
|
['-----BEGIN PGP PRIVATE KEY BLOCK-----',
|
|
'Version: OpenPGP.js v0.3.0',
|
|
'Comment: https://openpgpjs.org',
|
|
'',
|
|
'xbYEUubX7gEBANDWhzoP+Tr/IyRSv++vl5jBesQIPTYGQBdzF4YDnGEBABEB',
|
|
'AAH+CQMIfzdw4/PKNl5gVXdtfDFdSIN8yJT2rbeg3+SsWexXZNNdRaONWaiB',
|
|
'Z5cG9Q6+BoXKsEshIdcYOgwsAgRxlPpRA34Vvmg2QBk7PhdrkbK7aqENsJ1w',
|
|
'dIlLD6p9GmLE20yVff58/fMiUtPRgsD83SpKTAX6EM1ulpkuQQNjmrVc5qc8',
|
|
'7AMdF80JdW5kZWZpbmVkwj8EEAEIABMFAlLm1+4JEBD8MASZrpALAhsDAAAs',
|
|
'QgD8CUrwv7Hrp/INR0/UvAvzS52VztREQwQWTJMrgTNHBGjHtgRS5tfuAQEA',
|
|
'nys9SaSgR+l6iZc/M8hGIUmbuahE2/+mtw+/l0RO+WcAEQEAAf4JAwjr39Yi',
|
|
'FzjxImDN1IoYVsonA9M+BtIIJHafuQUHjyEr1paJJK5xS6KlyGgpMTXTD6y/',
|
|
'qxS3ZSPPzHGRrs2CmkVEiPmurn9Ed05tb0y9OnJkWtuh3z9VVq9d8zHzuENa',
|
|
'bUfli+P/v+dRaZ+1rSOxUFbFYbFB5XK/A9b/OPFrv+mb4KrtLxugwj8EGAEI',
|
|
'ABMFAlLm1+4JEBD8MASZrpALAhsMAAC3IgD8DnLGbMnpLtrX72RCkPW1ffLq',
|
|
'71vlXMJNXvoCeuejiRw=',
|
|
'-----END PGP PRIVATE KEY BLOCK-----',
|
|
''].join('\n');
|
|
|
|
// try with default config
|
|
const result_1 = await openpgp.key.readArmored(privKeyNoCheckSumWithTrailingNewline);
|
|
if(openpgp.config.checksum_required) {
|
|
expect(result_1.err).to.exist;
|
|
expect(result_1.err[0].message).to.match(/Ascii armor integrity check on message failed/);
|
|
} else {
|
|
expect(result_1.err).to.not.exist;
|
|
}
|
|
|
|
// try opposite config
|
|
openpgp.config.checksum_required = !openpgp.config.checksum_required;
|
|
const result_2 = await openpgp.key.readArmored(privKeyNoCheckSumWithTrailingNewline);
|
|
if(openpgp.config.checksum_required) {
|
|
expect(result_2.err).to.exist;
|
|
expect(result_2.err[0].message).to.match(/Ascii armor integrity check on message failed/);
|
|
} else {
|
|
expect(result_2.err).to.not.exist;
|
|
}
|
|
|
|
// back to default
|
|
openpgp.config.checksum_required = !openpgp.config.checksum_required;
|
|
});
|
|
|
|
it('Accept header with trailing whitespace', async function () {
|
|
const privKey =
|
|
['-----BEGIN PGP PRIVATE KEY BLOCK-----',
|
|
'Version: OpenPGP.js v0.3.0',
|
|
'Comment: https://openpgpjs.org',
|
|
'',
|
|
'xbYEUubX7gEBANDWhzoP+Tr/IyRSv++vl5jBesQIPTYGQBdzF4YDnGEBABEB',
|
|
'AAH+CQMIfzdw4/PKNl5gVXdtfDFdSIN8yJT2rbeg3+SsWexXZNNdRaONWaiB',
|
|
'Z5cG9Q6+BoXKsEshIdcYOgwsAgRxlPpRA34Vvmg2QBk7PhdrkbK7aqENsJ1w',
|
|
'dIlLD6p9GmLE20yVff58/fMiUtPRgsD83SpKTAX6EM1ulpkuQQNjmrVc5qc8',
|
|
'7AMdF80JdW5kZWZpbmVkwj8EEAEIABMFAlLm1+4JEBD8MASZrpALAhsDAAAs',
|
|
'QgD8CUrwv7Hrp/INR0/UvAvzS52VztREQwQWTJMrgTNHBGjHtgRS5tfuAQEA',
|
|
'nys9SaSgR+l6iZc/M8hGIUmbuahE2/+mtw+/l0RO+WcAEQEAAf4JAwjr39Yi',
|
|
'FzjxImDN1IoYVsonA9M+BtIIJHafuQUHjyEr1paJJK5xS6KlyGgpMTXTD6y/',
|
|
'qxS3ZSPPzHGRrs2CmkVEiPmurn9Ed05tb0y9OnJkWtuh3z9VVq9d8zHzuENa',
|
|
'bUfli+P/v+dRaZ+1rSOxUFbFYbFB5XK/A9b/OPFrv+mb4KrtLxugwj8EGAEI',
|
|
'ABMFAlLm1+4JEBD8MASZrpALAhsMAAC3IgD8DnLGbMnpLtrX72RCkPW1ffLq',
|
|
'71vlXMJNXvoCeuejiRw=',
|
|
'=wJNM',
|
|
'-----END PGP PRIVATE KEY BLOCK-----',
|
|
''].join('\t \r\n');
|
|
|
|
const result = await openpgp.key.readArmored(privKey);
|
|
expect(result.err).to.not.exist;
|
|
expect(result.keys[0]).to.be.an.instanceof(openpgp.key.Key);
|
|
});
|
|
|
|
it('Do not filter blank lines after header', async function () {
|
|
let msg = getArmor(['Hash: SHA1', '']);
|
|
msg = await openpgp.cleartext.readArmored(msg);
|
|
expect(msg.text).to.equal('\r\nsign this');
|
|
});
|
|
|
|
it('Do not add extraneous blank line when base64 ends on line break', async function () {
|
|
let pubKey = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
|
|
xsFNBFuR4MABEACoJ9e8zvhj80mFWJzxDErNnD78taGh7hJTs/H1CIIAykjf
|
|
NEvTWcnnDI2dsK7J+dBQq9R40G5YYDUvA2dMztqq5BuaUlJvdSiQtqMcirhF
|
|
J73brsfpqtiJAGWSfb7znLqPV8mYdx5n12XWy+J6qRnNPJKLYP5XmLVHbICr
|
|
XGoDu5aKE8bOMRItoUcM3SKmES4NJrgdRLriax+OoeX/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gyV6PstrhRytHpKLit0PEYg/+qR+wARAQABwsFfBBgB
|
|
CAATBQJbkeDACRDC00GPww7TMQIbDAAAn/wP/2t8bB500NWBSqAFefc1NdZG
|
|
X6Gq2GUKB03yjIpkW1HmerK5ubE3VC7jJ20rDO4SQ8N/MCAnferNWYWu+xHb
|
|
xM88GCY2EHLrvo+nJIA12A7BK4C7nE7okOCdk8OGEBfkscgmnXvJ3Z/wrEVu
|
|
1MqBYSZpGGZh3E+lPu/krd63doP584oJ00o2mm6yPfeXibNmcmVIDH1dwgCO
|
|
AlVaObUK77FGkpcWB3gQ9LaKEriNgP6SWA8jM0UopHBKCEkQ5JNZLFX/K2CS
|
|
hcUE62rQNHBLFne8mmUGeXjqFETEl0jwdef+hDuQDqE0y0ISmQRQaffahRkH
|
|
ORnEtK72Qj9CD7Wn3fXgIXbtAhIti4qgmJQJ5FkyJdSpM8ouKEMGGoqO4vHe
|
|
DbDzof7l+RsGNj0KEDlgiIov8DpWc+EFDApn7C4K7c+ojBnzvuwTVymjCA5+
|
|
WIQaz81fLW+ft5d/lHHpyc+Cm+VVn8NbQw5qlmrLOQKHfJPUoYF4izevHXCF
|
|
VWx8AtKEInT8YvN19cS2Jpr81jCN819IqgDr+YQezYMwZMzWISmA3w5Z3UCU
|
|
lO771jlg4fHlWOZ2nJqselFlNc3X/VoZ8swmMkI6KVDV+rKaeyTWe61Up0Jj
|
|
NJCB6+LWtabSoVIjNVgKwyKqyTLaESNwC2ogZwkdE8qPGiDFEHo4Gg9zuRof
|
|
|
|
=trqv
|
|
-----END PGP PUBLIC KEY BLOCK-----
|
|
`;
|
|
|
|
const { type, data } = await openpgp.armor.decode(pubKey);
|
|
const armor = await openpgp.stream.readToEnd(openpgp.armor.encode(type, data));
|
|
expect(
|
|
armor
|
|
.replace(/^(Version|Comment): .*$\r\n/mg, '')
|
|
).to.equal(
|
|
pubKey
|
|
.replace('\n=', '=')
|
|
.replace(/\n/g, '\r\n')
|
|
);
|
|
});
|
|
|
|
});
|
|
|