mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-07 15:07:11 -04:00
Improve ASCII armor tests for PGP messages
This commit is contained in:
parent
7188f9397f
commit
f60b06f4be
1 changed files with 41 additions and 38 deletions
|
@ -70,21 +70,6 @@ var CYBERCHEF_GENERATED_KEY_PAIRS = [
|
||||||
"=8R+g",
|
"=8R+g",
|
||||||
"-----END PGP PRIVATE KEY BLOCK-----",
|
"-----END PGP PRIVATE KEY BLOCK-----",
|
||||||
].join("\n"),
|
].join("\n"),
|
||||||
messages: [
|
|
||||||
[
|
|
||||||
"-----BEGIN PGP MESSAGE-----",
|
|
||||||
"Version: OpenPGP.js v2.3.6",
|
|
||||||
"Comment: http://openpgpjs.org",
|
|
||||||
"",
|
|
||||||
"wYwDmsTgRYVqFPcBA/kBfc7BnEcbKGwac/JOSK6YWzpDERR8NjJT/3R7JDsG",
|
|
||||||
"ywJB/ouaHy3e5KGDulALV6pUzcPbCC0CCl5tlFVaFYAj6+BdwR/WCb7dhlRE",
|
|
||||||
"x+vw5VKLlY6adSgtvU9aLF0nL0YlU9Pxf9wrPdo3bvxJij7S4mbGS2iybhQO",
|
|
||||||
"41ZUtWhOotI9AR/e7f2WHSt8dpl7T9Uq8trAptFWVIZkj+78Gp/8u5o8/mqV",
|
|
||||||
"9gxmOGsViKhVZ1b554nwd243IrqlzW2szg==",
|
|
||||||
"=prpZ",
|
|
||||||
"-----END PGP MESSAGE-----",
|
|
||||||
].join("\n"),
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -465,27 +450,45 @@ TestRegister.addTests(CYBERCHEF_GENERATED_KEY_PAIRS.map(function(keyPair) {
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
|
|
||||||
CYBERCHEF_GENERATED_KEY_PAIRS.forEach(function(keyPair) {
|
PGP_TEST_KEY_PAIRS.forEach(function(keyPair) {
|
||||||
TestRegister.addTests(keyPair.messages.map(function(encryptedMessage, messageIndex) {
|
TestRegister.addTests(
|
||||||
var testName = "Remove PGP ASCII Armor, Add PGP ASCII Armor: Message $message '$name'";
|
["", "hello world"].map(function(message, messageIndex) {
|
||||||
testName = testName.replace("$message", messageIndex);
|
var testName = "PGP Encrypt, Remove PGP ASCII Armor, Add PGP ASCII Armor, PGP Decrypt: Message $message '$name'";
|
||||||
testName = testName.replace("$name", keyPair.name);
|
testName = testName.replace("$message", messageIndex);
|
||||||
|
testName = testName.replace("$name", keyPair.name);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: testName,
|
name: testName,
|
||||||
input: encryptedMessage,
|
input: message,
|
||||||
expectedOutput: encryptedMessage,
|
expectedOutput: message,
|
||||||
ignoreWhitespace: true,
|
ignoreWhitespace: true,
|
||||||
recipeConfig: [
|
recipeConfig: [
|
||||||
{
|
{
|
||||||
op: "Remove PGP ASCII Armor",
|
op: "PGP Encrypt",
|
||||||
args: [],
|
args: [keyPair.pub],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
op: "Add PGP ASCII Armor",
|
op: "Remove PGP ASCII Armor",
|
||||||
args: ["Message"],
|
args: [],
|
||||||
},
|
},
|
||||||
],
|
{
|
||||||
};
|
op: "To Hex",
|
||||||
}));
|
args: ["None"],
|
||||||
});
|
},
|
||||||
|
{
|
||||||
|
op: "From Hex",
|
||||||
|
args: ["None"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
op: "Add PGP ASCII Armor",
|
||||||
|
args: ["Message"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
op: "PGP Decrypt",
|
||||||
|
args: [keyPair.sec, keyPair.password],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
})
|
||||||
|
)
|
||||||
|
});
|
Loading…
Add table
Add a link
Reference in a new issue