mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-07 15:07:11 -04:00
Add tests for PGP decrypting passwords correctly
This commit is contained in:
parent
8db94be8ac
commit
58f7e57896
1 changed files with 28 additions and 0 deletions
|
@ -197,6 +197,34 @@ var PGP_TEST_KEY_PAIRS = [
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
PGP_TEST_KEY_PAIRS.forEach(function(keyPair) {
|
||||||
|
if (keyPair.password) {
|
||||||
|
TestRegister.addTests(
|
||||||
|
["", "nottherightpassword"].map(function(incorrectPW) {
|
||||||
|
var testName = "PGP Encrypt, PGP Decrypt: ensure error for incorrect password (pw [$pw], $ks, $name)";
|
||||||
|
testName = testName.replace("$ks", keyPair.size);
|
||||||
|
testName = testName.replace("$pw", incorrectPW);
|
||||||
|
|
||||||
|
return {
|
||||||
|
name: testName,
|
||||||
|
input: "hello world",
|
||||||
|
expectedError: true,
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
op: "PGP Encrypt",
|
||||||
|
args: [keyPair.pub],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
op: "PGP Decrypt",
|
||||||
|
args: [keyPair.sec, incorrectPW],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
["", "hello world"].forEach(function(input) {
|
["", "hello world"].forEach(function(input) {
|
||||||
TestRegister.addTests(
|
TestRegister.addTests(
|
||||||
PGP_TEST_KEY_PAIRS.map(function(keyPair) {
|
PGP_TEST_KEY_PAIRS.map(function(keyPair) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue