Added tests

This commit is contained in:
Matt 2019-06-27 17:30:44 +01:00
parent 4c27a46d35
commit c46928aefe
No known key found for this signature in database
GPG key ID: 2DD462FE98BF38C2
3 changed files with 30 additions and 3 deletions

View file

@ -101,8 +101,8 @@ class PGPDecryptAndVerify extends Operation {
text += "\n"; text += "\n";
} }
text += [ text += [
`PGP fingerprint: ${km.get_pgp_fingerprint().toString("hex")}`,
`PGP key ID: ${km.get_pgp_short_key_id()}`, `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()}`, `Signed on ${new Date(ds.sig.when_generated() * 1000).toUTCString()}`,
"----------------------------------\n" "----------------------------------\n"
].join("\n"); ].join("\n");

View file

@ -88,8 +88,8 @@ class PGPVerify extends Operation {
text += "\n"; text += "\n";
} }
text += [ text += [
`PGP fingerprint: ${km.get_pgp_fingerprint().toString("hex")}`,
`PGP key ID: ${km.get_pgp_short_key_id()}`, `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()}`, `Signed on ${new Date(ds.sig.when_generated() * 1000).toUTCString()}`,
"----------------------------------\n" "----------------------------------\n"
].join("\n"); ].join("\n");

View file

@ -248,7 +248,8 @@ IOE1W/Zqmqzq+4frwnzWwYv9/U1RwIs/qlFVnzliREOzW+om8EncSSd7fQ==
=fEAT =fEAT
-----END PGP MESSAGE----- -----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 Signed on Tue, 29 May 2018 15:44:52 GMT
---------------------------------- ----------------------------------
${UTF8_TEXT}`, ${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]
}
]
}
]); ]);