diff options
author | Jack Lloyd <[email protected]> | 2017-05-28 14:28:19 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-05-28 14:28:19 -0400 |
commit | fd6e6d8ed957e081b03072661f632679035c317f (patch) | |
tree | 8a2ffdb067d589d30678e931c101f461c085431c /src/tests | |
parent | a293c21ba83fb9c4d59237f8fa0fd5d852c27992 (diff) | |
parent | ce5253938fd5df031db1ee1cb7443c685fd8746e (diff) |
Merge GH #1060 Add PGP-S2K
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/data/pbkdf/pgp_s2k.vec | 67 | ||||
-rw-r--r-- | src/tests/test_pbkdf.cpp | 4 |
2 files changed, 69 insertions, 2 deletions
diff --git a/src/tests/data/pbkdf/pgp_s2k.vec b/src/tests/data/pbkdf/pgp_s2k.vec new file mode 100644 index 000000000..21bac5343 --- /dev/null +++ b/src/tests/data/pbkdf/pgp_s2k.vec @@ -0,0 +1,67 @@ +[OpenPGP-S2K(SHA-160)] +# Generated using Golang x/crypto/openpgp/s2k + +Salt = +Iterations = 1 +Passphrase = hello +Output = AAF4C61D + +Salt = 01020304 +Iterations = 1 +Passphrase = hello +Output = 10295AC1 + +Salt = 01020304 +Iterations = 1 +Passphrase = bar +Output = BD8AAC6B9EA9CAE04EAE6A91C6133B58B5D9A61C14F355516ED9370456 + +Salt = 04030201 +Iterations = 31 +Passphrase = bar +Output = 2AF5A99B54F093789FD657F19BD245AF7604D0F6AE06F66602A46A08AE + +Salt = 2AE6E5831A717917 +Iterations = 65536 +Passphrase = ilikepie +Output = A32F874A4CF95DFAD8359302B395455C + +Salt = 0102030405060708 +Iterations = 1 +Passphrase = passphrase +Output = eec8929a31187dd3a9a7ce5a97d96a67706382bbef70fe3b2a3aeeaf176bce252c117970a51fd8b770a69f8ecb199505395bd7b0c0760d6a38ac82900b23fe3b + +Salt = 0102030405060708 +Iterations = 65536 +Passphrase = passphrase +Output = 24ce08a4a31de2208acdc15347def7a63492d38a0c08f80533a746279d91cb25e1b6b740b09e20a4884ca1944d506eb200753761066e8d4b24957c2593388457 + +Salt = 0102030405060708 +Iterations = 10000000 +Passphrase = passphrase +Output = 09efbd3599e2453c6cf1749a7ed169514a12d1a721549468c6d0ef6737fa3e27ab6d100f9839694fc70c484a42b00ef87463d07e2aafb92033843a4bd5f37971 + +[OpenPGP-S2K(SHA-384)] +# Generated using Golang x/crypto/openpgp/s2k + +Salt = 0102030405060708 +Iterations = 1 +Passphrase = passphrase +Output = ea024c2de8af9a3edfbac9422f7b17e17c3165147b43f4edd58b55af9a412d07e0631f431a7e0028fbb145d9d5e059a888f1a7526cd338b1b6082a8681b446fa + +Salt = 0102030405060708 +Iterations = 18 +Passphrase = passphrase +Output = ea024c2de8af9a3edfbac9422f7b17e17c3165147b43f4edd58b55af9a412d07e0631f431a7e0028fbb145d9d5e059a888f1a7526cd338b1b6082a8681b446fa + +Salt = 0102030405060708 +Iterations = 19 +Passphrase = passphrase +Output = 491aa377a1a9526d53b118587a03f85f5dc64568f3aabaad66aafc923397fb74d7017a6a4812bff2d9beddcbc6a0dbd3b96a3f9a69b637d68670acd48d4dfa4e + +Salt = 0102030405060708 +Iterations = 1000000 +Passphrase = passphrase +Output = af4986488f4e53ac4f7991a0bb8de15441ba1070481fe63b126ff3de2e1072f568dd3d6c5887d008925d27649494ae6f4860e141d5eeabe4f93745ca9cb8e08c + + diff --git a/src/tests/test_pbkdf.cpp b/src/tests/test_pbkdf.cpp index bd2fd8f89..32144bd9b 100644 --- a/src/tests/test_pbkdf.cpp +++ b/src/tests/test_pbkdf.cpp @@ -18,15 +18,15 @@ namespace { class PBKDF_KAT_Tests : public Text_Based_Test { public: - PBKDF_KAT_Tests() : Text_Based_Test("pbkdf", "OutputLen,Iterations,Salt,Passphrase,Output") {} + PBKDF_KAT_Tests() : Text_Based_Test("pbkdf", "Iterations,Salt,Passphrase,Output", "OutputLen") {} Test::Result run_one_test(const std::string& pbkdf_name, const VarMap& vars) override { - const size_t outlen = get_req_sz(vars, "OutputLen"); const size_t iterations = get_req_sz(vars, "Iterations"); const std::vector<uint8_t> salt = get_req_bin(vars, "Salt"); const std::string passphrase = get_req_str(vars, "Passphrase"); const std::vector<uint8_t> expected = get_req_bin(vars, "Output"); + const size_t outlen = get_opt_sz(vars, "OutputLen", expected.size()); Test::Result result(pbkdf_name); std::unique_ptr<Botan::PBKDF> pbkdf(Botan::PBKDF::create(pbkdf_name)); |