aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-12-08 21:37:20 -0500
committerJack Lloyd <[email protected]>2016-12-08 21:37:20 -0500
commit3d7336406f329902cf785732c3e0fa2efb25bdd1 (patch)
treed3ee3c9b3f037777540926bc335f76eb95748e3b /src
parent578d4208f7410e110a084fbcfaa30eea1d057f9e (diff)
parent63a1c6cd6b40868a5234428830fee0d63fd51ba2 (diff)
Merge GH #759 Add ISO 9796-2 signature schemes
Diffstat (limited to 'src')
-rw-r--r--src/lib/pk_pad/emsa.cpp55
-rw-r--r--src/lib/pk_pad/iso9796/info.txt7
-rw-r--r--src/lib/pk_pad/iso9796/iso9796.cpp270
-rw-r--r--src/lib/pk_pad/iso9796/iso9796.h94
-rw-r--r--src/tests/data/pubkey/rsa_sig.vec31
-rw-r--r--src/tests/data/pubkey/rsa_verify.vec25
6 files changed, 470 insertions, 12 deletions
diff --git a/src/lib/pk_pad/emsa.cpp b/src/lib/pk_pad/emsa.cpp
index 66e58fb0d..3851f85a7 100644
--- a/src/lib/pk_pad/emsa.cpp
+++ b/src/lib/pk_pad/emsa.cpp
@@ -8,23 +8,27 @@
#include <botan/scan_name.h>
#if defined(BOTAN_HAS_EMSA1)
- #include <botan/emsa1.h>
+ #include <botan/emsa1.h>
#endif
#if defined(BOTAN_HAS_EMSA_X931)
- #include <botan/emsa_x931.h>
+ #include <botan/emsa_x931.h>
#endif
#if defined(BOTAN_HAS_EMSA_PKCS1)
- #include <botan/emsa_pkcs1.h>
+ #include <botan/emsa_pkcs1.h>
#endif
#if defined(BOTAN_HAS_EMSA_PSSR)
- #include <botan/pssr.h>
+ #include <botan/pssr.h>
#endif
#if defined(BOTAN_HAS_EMSA_RAW)
- #include <botan/emsa_raw.h>
+ #include <botan/emsa_raw.h>
+#endif
+
+#if defined(BOTAN_HAS_ISO_9796)
+ #include <botan/iso9796.h>
#endif
namespace Botan {
@@ -45,8 +49,8 @@ EMSA* get_emsa(const std::string& algo_spec)
#if defined(BOTAN_HAS_EMSA_PKCS1)
if(req.algo_name() == "EMSA_PKCS1" ||
- req.algo_name() == "EMSA-PKCS1-v1_5" ||
- req.algo_name() == "EMSA3")
+ req.algo_name() == "EMSA-PKCS1-v1_5" ||
+ req.algo_name() == "EMSA3")
{
if(req.arg_count() == 1)
{
@@ -67,9 +71,9 @@ EMSA* get_emsa(const std::string& algo_spec)
#if defined(BOTAN_HAS_EMSA_PSSR)
if(req.algo_name() == "PSSR" ||
- req.algo_name() == "EMSA-PSS" ||
- req.algo_name() == "PSS-MGF1" ||
- req.algo_name() == "EMSA4")
+ req.algo_name() == "EMSA-PSS" ||
+ req.algo_name() == "PSS-MGF1" ||
+ req.algo_name() == "EMSA4")
{
if(req.arg_count_between(1, 3))
{
@@ -85,10 +89,37 @@ EMSA* get_emsa(const std::string& algo_spec)
}
#endif
+#if defined(BOTAN_HAS_ISO_9796)
+ if(req.algo_name() == "ISO_9796_DS2")
+ {
+ if(req.arg_count_between(1, 3))
+ {
+ if(auto h = HashFunction::create(req.arg(0)))
+ {
+ const size_t salt_size = req.arg_as_integer(2, h->output_length());
+ const bool implicit = req.arg(1, "exp") == "imp";
+ return new ISO_9796_DS2(h.release(), implicit, salt_size);
+ }
+ }
+ }
+ //ISO-9796-2 DS 3 is deterministic and DS2 without a salt
+ if(req.algo_name() == "ISO_9796_DS3")
+ {
+ if(req.arg_count_between(1, 2))
+ {
+ if(auto h = HashFunction::create(req.arg(0)))
+ {
+ const bool implicit = req.arg(1, "exp") == "imp";
+ return new ISO_9796_DS3(h.release(), implicit);
+ }
+ }
+ }
+#endif
+
#if defined(BOTAN_HAS_EMSA_X931)
if(req.algo_name() == "EMSA_X931" ||
- req.algo_name() == "EMSA2" ||
- req.algo_name() == "X9.31")
+ req.algo_name() == "EMSA2" ||
+ req.algo_name() == "X9.31")
{
if(req.arg_count() == 1)
{
diff --git a/src/lib/pk_pad/iso9796/info.txt b/src/lib/pk_pad/iso9796/info.txt
new file mode 100644
index 000000000..3458ece45
--- /dev/null
+++ b/src/lib/pk_pad/iso9796/info.txt
@@ -0,0 +1,7 @@
+define ISO_9796 20161121
+
+<requires>
+mgf1
+hash_id
+</requires>
+
diff --git a/src/lib/pk_pad/iso9796/iso9796.cpp b/src/lib/pk_pad/iso9796/iso9796.cpp
new file mode 100644
index 000000000..db79661e3
--- /dev/null
+++ b/src/lib/pk_pad/iso9796/iso9796.cpp
@@ -0,0 +1,270 @@
+/*
+ * ISO-9796-2 - Digital signature schemes giving message recovery schemes 2 and 3
+ * (C) 2016 Tobias Niemann, Hackmanit GmbH
+ *
+ * Botan is released under the Simplified BSD License (see license.txt)
+ */
+
+#include <botan/iso9796.h>
+#include <botan/mgf1.h>
+#include <botan/internal/bit_ops.h>
+#include <botan/hash_id.h>
+
+namespace Botan {
+
+namespace {
+
+secure_vector<byte> iso9796_encoding(const secure_vector<byte>& msg,
+ size_t output_bits, std::unique_ptr<HashFunction>& hash, size_t SALT_SIZE, bool implicit, RandomNumberGenerator& rng)
+ {
+ const size_t output_length = (output_bits + 7) / 8;
+
+ //set trailer length
+ size_t tLength = 1;
+ if(!implicit)
+ {
+ tLength = 2;
+ }
+ const size_t HASH_SIZE = hash->output_length();
+
+ if(output_length <= HASH_SIZE + SALT_SIZE + tLength)
+ {
+ throw Encoding_Error("ISO9796-2::encoding_of: Output length is too small");
+ }
+
+ //calculate message capacity
+ const size_t capacity = output_length
+ - HASH_SIZE - SALT_SIZE - tLength - 1;
+
+ //msg1 is the recoverable and msg2 the unrecoverable message part.
+ secure_vector<byte> msg1;
+ secure_vector<byte> msg2;
+ if(msg.size() > capacity)
+ {
+ msg1 = secure_vector<byte> (msg.begin(), msg.begin() + capacity);
+ msg2 = secure_vector<byte> (msg.begin() + capacity, msg.end());
+ hash->update(msg2);
+ }
+ else
+ {
+ msg1 = msg;
+ }
+ msg2 = hash->final();
+
+ //compute H(C||msg1 ||H(msg2)||S)
+ uint64_t msgLength = msg1.size();
+ secure_vector<byte> salt = rng.random_vec(SALT_SIZE);
+ hash->update_be(msgLength * 8);
+ hash->update(msg1);
+ hash->update(msg2);
+ hash->update(salt);
+ secure_vector<byte> H = hash->final();
+
+ secure_vector<byte> EM(output_length);
+
+ //compute message offset.
+ size_t offset = output_length - HASH_SIZE - SALT_SIZE - tLength
+ - msgLength - 1;
+
+ //insert message border (0x01), msg1 and salt into the output buffer
+ EM[offset] = 0x01;
+ buffer_insert(EM, offset + 1, msg1);
+ buffer_insert(EM, offset + 1 + msgLength, salt);
+
+ //apply mask
+ mgf1_mask(*hash, H.data(), HASH_SIZE, EM.data(),
+ output_length - HASH_SIZE - tLength);
+ buffer_insert(EM, output_length - HASH_SIZE - tLength, H);
+ //set implicit/ISO trailer
+ if(!implicit)
+ {
+ byte hash_id = ieee1363_hash_id(hash->name());
+ if(!hash_id)
+ {
+ throw Encoding_Error("ISO9796-2::encoding_of: no hash identifier for " + hash->name());
+ }
+ EM[output_length - 1] = 0xCC;
+ EM[output_length - 2] = hash_id;
+
+ }
+ else
+ {
+ EM[output_length - 1] = 0xBC;
+ }
+ //clear the leftmost bit (confer bouncy castle)
+ EM[0] &= 0x7F;
+
+ return EM;
+ }
+
+bool iso9796_verification(const secure_vector<byte>& const_coded,
+ const secure_vector<byte>& raw, size_t key_bits, std::unique_ptr<HashFunction>& hash, size_t SALT_SIZE)
+ {
+ const size_t HASH_SIZE = hash->output_length();
+ const size_t KEY_BYTES = (key_bits + 7) / 8;
+
+ if(const_coded.size() != KEY_BYTES)
+ {
+ return false;
+ }
+ //get trailer length
+ size_t tLength;
+ if(const_coded[const_coded.size() - 1] == 0xBC)
+ {
+ tLength = 1;
+ }
+ else
+ {
+ byte hash_id = ieee1363_hash_id(hash->name());
+ if((!const_coded[const_coded.size() - 2]) || (const_coded[const_coded.size() - 2] != hash_id) ||
+ (const_coded[const_coded.size() - 1] != 0xCC))
+ {
+ return false; //in case of wrong ISO trailer.
+ }
+ tLength = 2;
+ }
+
+ secure_vector<byte> coded = const_coded;
+
+ //remove mask
+ byte* DB = coded.data();
+ const size_t DB_size = coded.size() - HASH_SIZE - tLength;
+
+ const byte* H = &coded[DB_size];
+
+ mgf1_mask(*hash, H, HASH_SIZE, DB, DB_size);
+ //clear the leftmost bit (confer bouncy castle)
+ DB[0] &= 0x7F;
+
+ //recover msg1 and salt
+ size_t msg1_offset = 0;
+ for(size_t j = 0; j != DB_size; ++j)
+ {
+ if(DB[j] == 0x01)
+ {
+ msg1_offset = j + 1;
+ break;
+ }
+ }
+ if(msg1_offset == 0)
+ {
+ return false;
+ }
+ secure_vector<byte> msg1(coded.begin() + msg1_offset,
+ coded.end() - tLength - HASH_SIZE - SALT_SIZE);
+ secure_vector<byte> salt(coded.begin() + msg1_offset + msg1.size(),
+ coded.end() - tLength - HASH_SIZE);
+
+ //compute H2(C||msg1||H(msg2)||S*). * indicates a recovered value
+ const size_t capacity = (key_bits - 2 + 7) / 8 - HASH_SIZE
+ - SALT_SIZE - tLength - 1;
+ secure_vector<byte> msg1raw;
+ secure_vector<byte> msg2;
+ if(raw.size() > capacity)
+ {
+ msg1raw = secure_vector<byte> (raw.begin(), raw.begin() + capacity);
+ msg2 = secure_vector<byte> (raw.begin() + capacity, raw.end());
+ hash->update(msg2);
+ }
+ else
+ {
+ msg1raw = raw;
+ }
+ msg2 = hash->final();
+
+ uint64_t msg1rawLength = msg1raw.size();
+ hash->update_be(msg1rawLength * 8);
+ hash->update(msg1raw);
+ hash->update(msg2);
+ hash->update(salt);
+ secure_vector<byte> H3 = hash->final();
+
+ //compute H3(C*||msg1*||H(msg2)||S*) * indicates a recovered value
+ uint64_t msgLength = msg1.size();
+ hash->update_be(msgLength * 8);
+ hash->update(msg1);
+ hash->update(msg2);
+ hash->update(salt);
+ secure_vector<byte> H2 = hash->final();
+
+ //check if H3 == H2
+ return same_mem(H3.data(), H2.data(), HASH_SIZE);
+ }
+
+}
+/*
+ * ISO-9796-2 signature scheme 2
+ * DS 2 is probabilistic
+ */
+void ISO_9796_DS2::update(const byte input[], size_t length)
+ {
+ //need to buffer message completely, before digest
+ m_msg_buffer.insert(m_msg_buffer.end(), input, input+length);
+ }
+
+/*
+ * Return the raw (unencoded) data
+ */
+secure_vector<byte> ISO_9796_DS2::raw_data()
+ {
+ secure_vector<byte> retbuffer = m_msg_buffer;
+ m_msg_buffer.clear();
+ return retbuffer;
+ }
+
+/*
+ * ISO-9796-2 scheme 2 encode operation
+ */
+secure_vector<byte> ISO_9796_DS2::encoding_of(const secure_vector<byte>& msg,
+ size_t output_bits, RandomNumberGenerator& rng)
+ {
+ return iso9796_encoding(msg, output_bits, m_hash, m_SALT_SIZE, m_implicit, rng);
+ }
+
+/*
+ * ISO-9796-2 scheme 2 verify operation
+ */
+bool ISO_9796_DS2::verify(const secure_vector<byte>& const_coded,
+ const secure_vector<byte>& raw, size_t key_bits)
+ {
+ return iso9796_verification(const_coded,raw,key_bits,m_hash,m_SALT_SIZE);
+ }
+
+/*
+ * ISO-9796-2 signature scheme 3
+ * DS 3 is deterministic and equals DS2 without salt
+ */
+void ISO_9796_DS3::update(const byte input[], size_t length)
+ {
+ //need to buffer message completely, before digest
+ m_msg_buffer.insert(m_msg_buffer.end(), input, input+length);
+ }
+
+/*
+ * Return the raw (unencoded) data
+ */
+secure_vector<byte> ISO_9796_DS3::raw_data()
+ {
+ secure_vector<byte> retbuffer = m_msg_buffer;
+ m_msg_buffer.clear();
+ return retbuffer;
+ }
+
+/*
+ * ISO-9796-2 scheme 3 encode operation
+ */
+secure_vector<byte> ISO_9796_DS3::encoding_of(const secure_vector<byte>& msg,
+ size_t output_bits, RandomNumberGenerator& rng)
+ {
+ return iso9796_encoding(msg, output_bits, m_hash, 0, m_implicit, rng);
+ }
+
+/*
+ * ISO-9796-2 scheme 3 verify operation
+ */
+bool ISO_9796_DS3::verify(const secure_vector<byte>& const_coded,
+ const secure_vector<byte>& raw, size_t key_bits)
+ {
+ return iso9796_verification(const_coded, raw, key_bits, m_hash, 0);
+ }
+} \ No newline at end of file
diff --git a/src/lib/pk_pad/iso9796/iso9796.h b/src/lib/pk_pad/iso9796/iso9796.h
new file mode 100644
index 000000000..da3fff055
--- /dev/null
+++ b/src/lib/pk_pad/iso9796/iso9796.h
@@ -0,0 +1,94 @@
+/*
+ * ISO-9796-2 - Digital signature schemes giving message recovery schemes 2 and 3
+ * (C) 2016 Tobias Niemann, Hackmanit GmbH
+ *
+ * Botan is released under the Simplified BSD License (see license.txt)
+ */
+
+#ifndef BOTAN_ISO9796_H__
+#define BOTAN_ISO9796_H__
+
+#include <botan/emsa.h>
+#include <botan/hash.h>
+
+namespace Botan {
+
+/**
+* ISO-9796-2 - Digital signature scheme 2 (probabilistic)
+*/
+class BOTAN_DLL ISO_9796_DS2 final : public EMSA
+ {
+ public:
+ /**
+ * @param hash function to use
+ * @param use implicit ISO trailer
+ */
+ explicit ISO_9796_DS2(HashFunction* hash, bool implicit = false) : m_hash(hash), m_implicit(implicit),
+ m_SALT_SIZE(hash->output_length()) {}
+
+ /**
+ * @param hash function to use
+ * @param whether or not the trailer is implicit
+ * @param size of the salt to use in bytes
+ */
+ ISO_9796_DS2(HashFunction* hash, bool implicit, size_t salt_size) : m_hash(hash), m_implicit(implicit),
+ m_SALT_SIZE(salt_size) {}
+
+ EMSA* clone() override
+ {return new ISO_9796_DS2(m_hash->clone(), m_implicit, m_SALT_SIZE);}
+ private:
+ void update(const byte input[], size_t length) override;
+
+ secure_vector<byte> raw_data() override;
+
+ secure_vector<byte> encoding_of(const secure_vector<byte>& msg,
+ size_t output_bits,
+ RandomNumberGenerator& rng) override;
+
+ bool verify(const secure_vector<byte>& coded,
+ const secure_vector<byte>& raw,
+ size_t key_bits) override;
+
+ std::unique_ptr<HashFunction> m_hash;
+ bool m_implicit;
+ size_t m_SALT_SIZE;
+ secure_vector<byte> m_msg_buffer;
+ };
+
+/**
+* ISO-9796-2 - Digital signature scheme 3 (deterministic)
+*/
+class BOTAN_DLL ISO_9796_DS3 final : public EMSA
+ {
+ public:
+ /**
+ * @param hash function to use
+ * @param whether or not the trailer is implicit
+ */
+ ISO_9796_DS3(HashFunction* hash, bool implicit = false) : m_hash(hash), m_implicit(implicit)
+ {}
+
+ EMSA* clone() override
+ {return new ISO_9796_DS3(m_hash->clone(), m_implicit);}
+ private:
+ void update(const byte input[], size_t length) override;
+
+ secure_vector<byte> raw_data() override;
+
+ secure_vector<byte> encoding_of(const secure_vector<byte>& msg,
+ size_t output_bits,
+ RandomNumberGenerator& rng) override;
+
+ bool verify(const secure_vector<byte>& coded,
+ const secure_vector<byte>& raw,
+ size_t key_bits) override;
+
+ std::unique_ptr<HashFunction> m_hash;
+ bool m_implicit;
+ secure_vector<byte> m_msg_buffer;
+ };
+
+}
+
+#endif
+
diff --git a/src/tests/data/pubkey/rsa_sig.vec b/src/tests/data/pubkey/rsa_sig.vec
index c352d9205..19641cc19 100644
--- a/src/tests/data/pubkey/rsa_sig.vec
+++ b/src/tests/data/pubkey/rsa_sig.vec
@@ -772,3 +772,34 @@ Q = 1071223775029985949761012308882052996043679648337106606420705207383712700083
Msg = 454D5341342074657374206F66206C656164696E67203073
Nonce = E4AE5BB1DD6DF73F8F75E441DA531F0E493AC0A7
Signature = 8A64E30AEC76B278B08FF3BF61B7FF439DC2B0F6B789459F1386C0FBF24AF863EFC5A58C5E9CB841EA08D2E22E40293B1876BBB976947038AEEAA36B1751FF9713B9F7BD306D9360CC8D78B7A607F9CA7B4C18C308D85330E534337998D97D6F70F828D6AD1C9C7F6916476127993E4E6F7D596BA6C246F0EB7312A02D09BFB3
+
+#ISO_9796-2 vectors taken from ISO/IEC 9796-2:2010 document
+Padding = ISO_9796_DS2(RIPEMD-160)
+E = 3
+P = 13176640956344281513356976392849532512598068945161920056997631118946602896999615353776582205891131806103614584425872495163794790854278317730307910685772081
+Q = 13358438383296401212212241736599969968896810298006662295507317025593488175806254771169730332279046987319731418872067829932261464845981989557960242434323009
+Msg = FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210
+Nonce = 436BCA9954EC376C96B79C95D4B82686F3494AD3
+Signature = A4958BADDA6AB0F5E7F544BB1313DB93BB7336053678459A31386D3A9F0A477F37B853DF6BBBA87BECAC7CD2B19FFACD98B40E820B638D5F7DDAAE56FF198EF6AB1002C376C1FFDE03041201FF8E6AF94AFDF05606E10E32F3F6909134864AEBD983AAA2BD725FCCA288DECE27810D34807956DC78F3CFC4EA45A8DFADA4226C
+
+Padding = ISO_9796_DS3(SHA-1,imp)
+E = 3
+P = 13176640956344281513356976392849532512598068945161920056997631118946602896999615353776582205891131806103614584425872495163794790854278317730307910685772081
+Q = 13358438383296401212212241736599969968896810298006662295507317025593488175806254771169730332279046987319731418872067829932261464845981989557960242434323009
+Msg =
+Signature = F9DD9F72FAB4AFFCED3B0538C5848B27756AC50CB2890F4CBC268D96C5E91EE88E3B058F2EF6585FEF5323CA4E2C308CC6140CF5F53579605B3BF0CC621082EB77F4A42D3567355EAA151FB4652BAFFE58A4B3107A064669FD4177C8D79F5DE5EEC562FFA2D0F5D9C409AEA0D5B9F8DF493AF2F18F91D828CE32C4CC35C13113
+
+Padding = ISO_9796_DS2(SHA-1,imp)
+E = 3
+P = 13176640956344281513356976392849532512598068945161920056997631118946602896999615353776582205891131806103614584425872495163794790854278317730307910685772081
+Q = 13358438383296401212212241736599969968896810298006662295507317025593488175806254771169730332279046987319731418872067829932261464845981989557960242434323009
+Msg = 6162636462636465636465666465666765666768666768696768696A68696A6B696A6B6C6A6B6C6D6B6C6D6E6C6D6E6F6D6E6F706E6F70716F707172707172737172737472737475737475767475767775767778767778797778797A78797A61797A61627A6162636162636462636465
+Nonce = 4C95C1B87A1DE8ACC193C14CF3147FE9C6636078
+Signature = 92ACA17F284261771E4A1313C05104838C3CC91C1CB6F576CF95090A5FDEA51E3C189F65E6BA3F284268B4FF2363B3B912D023A91C96541AC1F9E60E58F6B3DA8DEB1B6941792AA6341DB18488366A5E1E18DBBAE4A2E39077A2B4FE1DFB34A2CCAD1812C4AFFAF55570855AAEB685DA2E1F124FF70F529FED02F515BFD572AE
+
+Padding = ISO_9796_DS3(SHA-1,exp)
+E = 3
+P = 13176640956344281513356976392849532512598068945161920056997631118946602896999615353776582205891131806103614584425872495163794790854278317730307910685772081
+Q = 13358438383296401212212241736599969968896810298006662295507317025593488175806254771169730332279046987319731418872067829932261464845981989557960242434323009
+Msg = FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA98
+Signature = 30147ECB074705DDF33EF765D0EE1017D5535AB39A7727C4D8D4DC4242C693BD1FB544ECAE2323D1185BED05C8AA5F699D3AAED41FC3ECF9DF297A6156D6BC865196A619806E3FDFF8A8416D2984EF9E339400134A6D17122FCF0946783AEBD46F11397E66863E7428F4542DE2AE8A307355633F380F937B308C149F14194487
diff --git a/src/tests/data/pubkey/rsa_verify.vec b/src/tests/data/pubkey/rsa_verify.vec
index 1a915d6b2..1b57d197a 100644
--- a/src/tests/data/pubkey/rsa_verify.vec
+++ b/src/tests/data/pubkey/rsa_verify.vec
@@ -159,3 +159,28 @@ E = 65537
N = 1701550760793421862543562289931026945394881781447262972888516885584876436247030582756068401883540332824266791335242161375224480335226475621762011038836557438486994223355586125107160686772929148665772020114806515137374005081042904112745447320291689531965352389072090097529696081399233391439242320144394058920893342027979668204812408099791474966507368371676137037366817304246182026179444421945259005812216012619671229384439063712942602208902904719453381421672196363
Msg = 7072696F6E636F7270
Signature = 32631E346368C620BAF6FA5475F04B56FB60BA5CA67D1E3E22805ED5910ECEE71777FE19827983151E88AA1F9E57E96FDC536CE2F927AA3B34A94441E72FB498A649864488D976A0A4AB7B6490451A4F4712A3AF3587579A791CF8CB18EA4AD388B5C34F6BF54E9CB0F4AC5EA21EA2AA42A2266EA755D5EFFC02FD41C583E1CBDA53C1821BB79FB392D68A4524B0F65EBB64FF6656C52BF54D5774DF2D916C9B793E206E0D5351D7B4D18DE3CA4CCFA8F7A3ABFB36048C9297F7512B3FDA70F7
+
+#ISO-9796-2 vectors taken from Bouncy Castle
+Padding = ISO_9796_DS2(RIPEMD-160,imp)
+E = 17
+N = 125242242467304226980818040029626771449089399969616333381049941622953718673240322529328207020354780888067722576207206966012991943446137640922660671107037754599453565985942582513009492907982173446675216454634592761000191710251638590123948630732326307922952494464857505415177402322499891218582307842351942219477
+Msg =
+Signature = 8df6d3e7d4381ee36ec8ec7c1067db3b28da9e06a31b16ebb30c004dcd7a7904a799445d57b4fe90fb697b1e747c38436edaf64584b61dd1c4ced18f4098a0cf0a50953daf56e18284f42826e00e8bd009003e475904da186acfe79c578af3b093a32d0f8ae8ec46853e803ec2b6cf09d8066d3d84e2862853b8a6d9ec66b9ec
+
+Padding = ISO_9796_DS3(SHA-1,exp)
+E = 17
+N = 125242242467304226980818040029626771449089399969616333381049941622953718673240322529328207020354780888067722576207206966012991943446137640922660671107037754599453565985942582513009492907982173446675216454634592761000191710251638590123948630732326307922952494464857505415177402322499891218582307842351942219477
+Msg = 6162636462636465636465666465666765666768666768696768696A68696A6B696A6B6C6A6B6C6D6B6C6D6E6C6D6E6F6D6E6F706E6F70716F70717270717273
+Signature = 2486dd61e560e661511db92f41045a87cbbb78ce577d28da533bc15fdf9cbc2748311a5faa6501270b46414ba3549de34160c1ef18eff339eeeae2c53f7ed4a5fddc19c5b3f5c391e8efb5548555d478f0698ec351f6a4974c9c74f0a0eba9fc03db9253f41f02ffc5f03cb9d1973946993aa3f831aa1d9e73a783e67bf7695d
+
+Padding = ISO_9796_DS2(RIPEMD-160,exp)
+E = 17
+N = 125242242467304226980818040029626771449089399969616333381049941622953718673240322529328207020354780888067722576207206966012991943446137640922660671107037754599453565985942582513009492907982173446675216454634592761000191710251638590123948630732326307922952494464857505415177402322499891218582307842351942219477
+Msg = FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA98
+Signature = 3d853e02ccea35ac803227458aaf5c964387e20390a476419e853ed415b3ad2ad750d19b4e4667597c1863ea2b0aa35fdbb4de589c4663583674e2c8d15d07daa54ff389ae96d78cceb2b5a50b649362357042b2c40d780361b7f6f089c7e27e92d21db1b3e3d368582e3dfdcf0312f727743c09c5c2cb3c0552b78db71be278
+
+Padding = ISO_9796_DS3(RIPEMD-160,imp)
+E = 17
+N = 125242242467304226980818040029626771449089399969616333381049941622953718673240322529328207020354780888067722576207206966012991943446137640922660671107037754599453565985942582513009492907982173446675216454634592761000191710251638590123948630732326307922952494464857505415177402322499891218582307842351942219477
+Msg = 6162636462636465636465666465666765666768666768696768696A68696A6B696A6B6C6A6B6C6D6B6C6D6E6C6D6E6F6D6E6F706E6F70716F707172707172737172737472737475737475767475767775767778767778797778797A78797A61797A61627A6162636162636462636465
+Signature = 5cf8d66c115143929ce7b568c14fef2faf5fad18b19d94b128be1f49dcc2168d51777fc23e448f84b0253b99fe735f2102314533b754b1ebf08a29085e9392fb6f4550be8948e7b9a55060b74a87d57aa6d82475176d2f7776d873afc4349cdf207a90304469f6256d83274bb698c6dabe9b209b8e6100f14d1ce290eaca175b \ No newline at end of file