aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-05-19 10:43:11 -0400
committerJack Lloyd <[email protected]>2017-05-19 10:43:11 -0400
commit08ea995eb6f55ae52ec74c5c76ea8a114c72ccf8 (patch)
treee49b1b1ea62e1f787064944f9a3910e1d88ffc55 /src/tests
parent2165cda540bac5311f46ac63480c5138a03adaca (diff)
parentbebecf225713bc7e8b2082adfd163a173e4483c1 (diff)
Merge GH #1051 Extensions for PKCSv1.5 signature formatting
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/data/pubkey/rsa_sig.vec8
-rw-r--r--src/tests/test_ffi.cpp27
2 files changed, 35 insertions, 0 deletions
diff --git a/src/tests/data/pubkey/rsa_sig.vec b/src/tests/data/pubkey/rsa_sig.vec
index 19641cc19..1560a78d6 100644
--- a/src/tests/data/pubkey/rsa_sig.vec
+++ b/src/tests/data/pubkey/rsa_sig.vec
@@ -239,6 +239,14 @@ Q = 1300628500736091066469357724169131719350514861299470388096939255066412050709
Msg = 2C88F626457046190AEB16FF2A499DF5820240A5248074445B2D54DDF0C298F57BFF
Signature = 0EB5DC0D319B97F56F1C71E381BC26F40012054BB9A597484946955886F83333D21E916D60C3FB667869383CF9AAF6C0A98641ECECCB9F3BD71943696A78609E6324386B2030D2B2DEF1692677E205282617AA40EBAEB48C86B884CF51884BC807BE2D7C83AE3C671DB24E141B76646F0466B0DBFF20362991D465F7A0F7B4324E54092A742E0FE4C66A200AF324706B7D1BDE1C0371AB5FAFD58EBDE5555D24DECF399553C94E45A3E5B3F491BEF76EA9B08C41C2F233F13F83C99D6D88EDAD
+Padding = EMSA3(Raw,MD5)
+E = 17
+P = 13029564622157791280616891297384459345543528892729268050647908228725108502227809382105716872483480064224030258864846430267698903993578412414816903162894041
+Q = 11607519244599001458239888881356890329831441554346650600093035021905318722027819107556373878744770935515508357488960347997325733372608114236427580844273703
+Msg = BA34C71DB7D125ED4E6B3A246D6F235C
+Signature = AA5E96F061E0F6FEAEEDAABA83BEA346BD4129B1F9F8380E8CB1E61860E47DA5262F0A2ADFECE7DBC02A53FFEA0C24EE162ABD8B818D4C125BC8351CCE0FA7C533C18EC7264593C3CB9201A5C0889DBB211CEB659135854C6510F3FE96DFD5A172D1037C4C7B1CFA6BA56529B6C5FAB72754F6518E114CB14F1CF63AD12E3B2A
+
+
Padding = EMSA3(MD5)
E = 17
P = 13029564622157791280616891297384459345543528892729268050647908228725108502227809382105716872483480064224030258864846430267698903993578412414816903162894041
diff --git a/src/tests/test_ffi.cpp b/src/tests/test_ffi.cpp
index 45c4c8a5b..624b01032 100644
--- a/src/tests/test_ffi.cpp
+++ b/src/tests/test_ffi.cpp
@@ -341,6 +341,7 @@ class FFI_Unit_Tests : public Test
results.push_back(ffi_test_ciphers_cbc());
results.push_back(ffi_test_ciphers_aead());
results.push_back(ffi_test_stream_ciphers());
+ results.push_back(ffi_test_pkcs_hash_id());
#if defined(BOTAN_HAS_RSA)
results.push_back(ffi_test_rsa(rng));
@@ -373,6 +374,32 @@ class FFI_Unit_Tests : public Test
}
private:
+ Test::Result ffi_test_pkcs_hash_id()
+ {
+ Test::Result result("FFI PKCS hash id");
+
+#if defined(BOTAN_HAS_HASH_ID)
+ std::vector<uint8_t> hash_id(64);
+ size_t hash_id_len;
+
+ hash_id_len = 3; // too short
+ TEST_FFI_RC(BOTAN_FFI_ERROR_INSUFFICIENT_BUFFER_SPACE,
+ botan_pkcs_hash_id, ("SHA-256", hash_id.data(), &hash_id_len));
+
+ result.test_eq("Expected SHA-256 PKCS hash id len", hash_id_len, 19);
+
+ TEST_FFI_OK(botan_pkcs_hash_id, ("SHA-256", hash_id.data(), &hash_id_len));
+
+ result.test_eq("Expected SHA-256 PKCS hash id len", hash_id_len, 19);
+
+ hash_id.resize(hash_id_len);
+ result.test_eq("Expected SHA_256 PKCS hash id",
+ hash_id, "3031300D060960864801650304020105000420");
+#endif
+
+ return result;
+ }
+
Test::Result ffi_test_ciphers_cbc()
{
Test::Result result("FFI CBC cipher");