From 1b68d7e53c4bc5e6b2938194b0f7eda78a72ce43 Mon Sep 17 00:00:00 2001 From: lloyd Date: Fri, 5 Mar 2010 06:47:02 +0000 Subject: Remove the sign() operation from the public key objects, totally replaced by using the ops. Add real ECDSA test vectors (two found in ANSI X9.62) --- src/pubkey/gost_3410/gost_3410.cpp | 40 -------------------------------------- 1 file changed, 40 deletions(-) (limited to 'src/pubkey/gost_3410/gost_3410.cpp') diff --git a/src/pubkey/gost_3410/gost_3410.cpp b/src/pubkey/gost_3410/gost_3410.cpp index ef0bac726..c3735c720 100644 --- a/src/pubkey/gost_3410/gost_3410.cpp +++ b/src/pubkey/gost_3410/gost_3410.cpp @@ -101,46 +101,6 @@ bool GOST_3410_PublicKey::verify(const byte msg[], u32bit msg_len, return (R.get_affine_x() == r); } -SecureVector -GOST_3410_PrivateKey::sign(const byte msg[], - u32bit msg_len, - RandomNumberGenerator& rng) const - { - if(private_value() == 0) - throw Invalid_State("GOST_3410::sign(): no private key"); - - const BigInt& n = domain().get_order(); - - if(n == 0) - throw Invalid_State("GOST_3410::sign(): domain parameters not set"); - - BigInt k; - do - k.randomize(rng, n.bits()-1); - while(k >= n); - - BigInt e(msg, msg_len); - - e %= n; - if(e == 0) - e = 1; - - PointGFp k_times_P = domain().get_base_point() * k; - k_times_P.check_invariants(); - - BigInt r = k_times_P.get_affine_x() % n; - - if(r == 0) - throw Invalid_State("GOST_3410::sign: r was zero"); - - BigInt s = (r*private_value() + k*e) % n; - - SecureVector output(2*n.bytes()); - r.binary_encode(output + (output.size() / 2 - r.bytes())); - s.binary_encode(output + (output.size() - s.bytes())); - return output; - } - GOST_3410_Signature_Operation::GOST_3410_Signature_Operation( const GOST_3410_PrivateKey& gost_3410) : -- cgit v1.2.3