diff options
-rw-r--r-- | src/pubkey/gost_3410/gost_3410.cpp | 33 | ||||
-rw-r--r-- | src/pubkey/gost_3410/gost_3410.h | 10 | ||||
-rw-r--r-- | src/pubkey/rsa/rsa.cpp | 9 | ||||
-rw-r--r-- | src/pubkey/rsa/rsa.h | 2 | ||||
-rw-r--r-- | src/pubkey/rw/rw.cpp | 49 | ||||
-rw-r--r-- | src/pubkey/rw/rw.h | 6 |
6 files changed, 0 insertions, 109 deletions
diff --git a/src/pubkey/gost_3410/gost_3410.cpp b/src/pubkey/gost_3410/gost_3410.cpp index 1c028eca3..9a7681cb2 100644 --- a/src/pubkey/gost_3410/gost_3410.cpp +++ b/src/pubkey/gost_3410/gost_3410.cpp @@ -68,39 +68,6 @@ GOST_3410_PublicKey::GOST_3410_PublicKey(const AlgorithmIdentifier& alg_id, } } -bool GOST_3410_PublicKey::verify(const byte msg[], u32bit msg_len, - const byte sig[], u32bit sig_len) const - { - const BigInt& n = domain().get_order(); - - if(n == 0) - throw Invalid_State("domain parameters not set"); - - if(sig_len != n.bytes()*2) - return false; - - BigInt e(msg, msg_len); - - BigInt r(sig, sig_len / 2); - BigInt s(sig + sig_len / 2, sig_len / 2); - - if(r < 0 || r >= n || s < 0 || s >= n) - return false; - - e %= n; - if(e == 0) - e = 1; - - BigInt v = inverse_mod(e, n); - - BigInt z1 = (s*v) % n; - BigInt z2 = (-r*v) % n; - - PointGFp R = (z1 * domain().get_base_point() + z2 * public_point()); - - return (R.get_affine_x() == r); - } - GOST_3410_Signature_Operation::GOST_3410_Signature_Operation( const GOST_3410_PrivateKey& gost_3410) : diff --git a/src/pubkey/gost_3410/gost_3410.h b/src/pubkey/gost_3410/gost_3410.h index ffaa6fc4e..b10421a02 100644 --- a/src/pubkey/gost_3410/gost_3410.h +++ b/src/pubkey/gost_3410/gost_3410.h @@ -61,16 +61,6 @@ class BOTAN_DLL GOST_3410_PublicKey : public virtual EC_PublicKey, u32bit message_part_size() const { return domain().get_order().bytes(); } - /** - * Verify a message with this key. - * @param message the byte array containing the message - * @param mess_len the number of bytes in the message byte array - * @param signature the byte array containing the signature - * @param sig_len the number of bytes in the signature byte array - */ - bool verify(const byte message[], u32bit mess_len, - const byte signature[], u32bit sig_len) const; - protected: GOST_3410_PublicKey() {} }; diff --git a/src/pubkey/rsa/rsa.cpp b/src/pubkey/rsa/rsa.cpp index f21459f7b..76165090e 100644 --- a/src/pubkey/rsa/rsa.cpp +++ b/src/pubkey/rsa/rsa.cpp @@ -34,15 +34,6 @@ SecureVector<byte> RSA_PublicKey::encrypt(const byte in[], u32bit len, } /* -* RSA Verification Function -*/ -SecureVector<byte> RSA_PublicKey::verify(const byte in[], u32bit len) const - { - BigInt i(in, len); - return BigInt::encode(public_op(i)); - } - -/* * Create a RSA private key */ RSA_PrivateKey::RSA_PrivateKey(RandomNumberGenerator& rng, diff --git a/src/pubkey/rsa/rsa.h b/src/pubkey/rsa/rsa.h index 43abf2a09..c62616cdc 100644 --- a/src/pubkey/rsa/rsa.h +++ b/src/pubkey/rsa/rsa.h @@ -25,8 +25,6 @@ class BOTAN_DLL RSA_PublicKey : public PK_Encrypting_Key, SecureVector<byte> encrypt(const byte[], u32bit, RandomNumberGenerator& rng) const; - SecureVector<byte> verify(const byte[], u32bit) const; - RSA_PublicKey(const AlgorithmIdentifier& alg_id, const MemoryRegion<byte>& key_bits) : IF_Scheme_PublicKey(alg_id, key_bits) diff --git a/src/pubkey/rw/rw.cpp b/src/pubkey/rw/rw.cpp index 85b10a69d..a1df0649b 100644 --- a/src/pubkey/rw/rw.cpp +++ b/src/pubkey/rw/rw.cpp @@ -15,34 +15,6 @@ namespace Botan { /* -* Rabin-Williams Public Operation -*/ -BigInt RW_PublicKey::public_op(const BigInt& i) const - { - if((i > (n >> 1)) || i.is_negative()) - throw Invalid_Argument(algo_name() + "::public_op: i > n / 2 || i < 0"); - - BigInt r = core.public_op(i); - if(r % 16 == 12) return r; - if(r % 8 == 6) return 2*r; - - r = n - r; - if(r % 16 == 12) return r; - if(r % 8 == 6) return 2*r; - - throw Invalid_Argument(algo_name() + "::public_op: Invalid input"); - } - -/* -* Rabin-Williams Verification Function -*/ -SecureVector<byte> RW_PublicKey::verify(const byte in[], u32bit len) const - { - BigInt i(in, len); - return BigInt::encode(public_op(i)); - } - -/* * Create a Rabin-Williams private key */ RW_PrivateKey::RW_PrivateKey(RandomNumberGenerator& rng, @@ -74,27 +46,6 @@ RW_PrivateKey::RW_PrivateKey(RandomNumberGenerator& rng, } /* -* Rabin-Williams Signature Operation -*/ -SecureVector<byte> RW_PrivateKey::sign(const byte in[], u32bit len, - RandomNumberGenerator&) const - { - BigInt i(in, len); - if(i >= n || i % 16 != 12) - throw Invalid_Argument(algo_name() + "::sign: Invalid input"); - - BigInt r; - if(jacobi(i, n) == 1) r = core.private_op(i); - else r = core.private_op(i >> 1); - - r = std::min(r, n - r); - if(i != public_op(r)) - throw Self_Test_Failure(algo_name() + " private operation check failed"); - - return BigInt::encode_1363(r, n.bytes()); - } - -/* * Check Private Rabin-Williams Parameters */ bool RW_PrivateKey::check_key(RandomNumberGenerator& rng, bool strong) const diff --git a/src/pubkey/rw/rw.h b/src/pubkey/rw/rw.h index 688e1db7f..232051862 100644 --- a/src/pubkey/rw/rw.h +++ b/src/pubkey/rw/rw.h @@ -21,8 +21,6 @@ class BOTAN_DLL RW_PublicKey : public PK_Verifying_with_MR_Key, public: std::string algo_name() const { return "RW"; } - SecureVector<byte> verify(const byte[], u32bit) const; - RW_PublicKey(const AlgorithmIdentifier& alg_id, const MemoryRegion<byte>& key_bits) : IF_Scheme_PublicKey(alg_id, key_bits) @@ -38,7 +36,6 @@ class BOTAN_DLL RW_PublicKey : public PK_Verifying_with_MR_Key, protected: RW_PublicKey() {} - BigInt public_op(const BigInt&) const; }; /* @@ -63,9 +60,6 @@ class BOTAN_DLL RW_PrivateKey : public RW_PublicKey, RW_PrivateKey(RandomNumberGenerator& rng, u32bit bits, u32bit = 2); bool check_key(RandomNumberGenerator& rng, bool) const; - - SecureVector<byte> sign(const byte[], u32bit, - RandomNumberGenerator& rng) const; }; class BOTAN_DLL RW_Signature_Operation : public PK_Ops::Signature |