From c46928aefe7b4070d0bc673308176c305c28533c Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 27 Jun 2019 17:30:44 +0100 Subject: [PATCH] Added tests --- src/core/operations/PGPDecryptAndVerify.mjs | 2 +- src/core/operations/PGPVerify.mjs | 2 +- tests/operations/tests/PGP.mjs | 29 ++++++++++++++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/core/operations/PGPDecryptAndVerify.mjs b/src/core/operations/PGPDecryptAndVerify.mjs index fabda3ee..21612a0f 100644 --- a/src/core/operations/PGPDecryptAndVerify.mjs +++ b/src/core/operations/PGPDecryptAndVerify.mjs @@ -101,8 +101,8 @@ class PGPDecryptAndVerify extends Operation { text += "\n"; } text += [ - `PGP fingerprint: ${km.get_pgp_fingerprint().toString("hex")}`, `PGP key ID: ${km.get_pgp_short_key_id()}`, + `PGP fingerprint: ${km.get_pgp_fingerprint().toString("hex")}`, `Signed on ${new Date(ds.sig.when_generated() * 1000).toUTCString()}`, "----------------------------------\n" ].join("\n"); diff --git a/src/core/operations/PGPVerify.mjs b/src/core/operations/PGPVerify.mjs index 6f42ced8..ad1173b1 100644 --- a/src/core/operations/PGPVerify.mjs +++ b/src/core/operations/PGPVerify.mjs @@ -88,8 +88,8 @@ class PGPVerify extends Operation { text += "\n"; } text += [ - `PGP fingerprint: ${km.get_pgp_fingerprint().toString("hex")}`, `PGP key ID: ${km.get_pgp_short_key_id()}`, + `PGP fingerprint: ${km.get_pgp_fingerprint().toString("hex")}`, `Signed on ${new Date(ds.sig.when_generated() * 1000).toUTCString()}`, "----------------------------------\n" ].join("\n"); diff --git a/tests/operations/tests/PGP.mjs b/tests/operations/tests/PGP.mjs index baf76fb8..8449add4 100644 --- a/tests/operations/tests/PGP.mjs +++ b/tests/operations/tests/PGP.mjs @@ -248,7 +248,8 @@ IOE1W/Zqmqzq+4frwnzWwYv9/U1RwIs/qlFVnzliREOzW+om8EncSSd7fQ== =fEAT -----END PGP MESSAGE----- `, - expectedOutput: `Signed by PGP fingerprint: e94e06dd0b3744a0e970de9d84246548df98e485 + expectedOutput: `Signed by PGP key ID: DF98E485 +PGP fingerprint: e94e06dd0b3744a0e970de9d84246548df98e485 Signed on Tue, 29 May 2018 15:44:52 GMT ---------------------------------- ${UTF8_TEXT}`, @@ -282,4 +283,30 @@ H2qMY1O7hezH3fp+EZzCAccJMtK7VPk13WAgMRH22HirG4aK1i75IVOtjBgObzDh } ] }, + { + name: "PGP Verify: ASCII, Alice", + input: `-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA256 + +A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. +-----BEGIN PGP SIGNATURE----- + +iLMEAQEIAB0WIQRLbJy6MLpYOr9qojE+2VNAUiMLOgUCXRTsvwAKCRA+2VNAUiML +OuaHBADMMNtsuN92Fb+UrDimsv6TDQpbJhDkwp9kZdKYP5HAmSYAhXBG7N+YCMw+ +v2FSpUu9jJiPBm1K1SEwLufQVexoRv6RsBNolRFB07sArau0s0DnIXUchCZWvyTP +1KsjBnDr84U2b11H58g4DlTT4gQrz30rFuHz9AGmPAtDHbSXIA== +=vnk/ +-----END PGP SIGNATURE-----`, + expectedOutput: `Signed by PGP key ID: DF98E485 +PGP fingerprint: e94e06dd0b3744a0e970de9d84246548df98e485 +Signed on Thu, 27 Jun 2019 16:20:15 GMT +---------------------------------- +A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.`, + recipeConfig: [ + { + "op": "PGP Verify", + "args": [ALICE_PUBLIC] + } + ] + } ]);