aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/gost_3410/gost_3410.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-05 06:47:02 +0000
committerlloyd <[email protected]>2010-03-05 06:47:02 +0000
commit1b68d7e53c4bc5e6b2938194b0f7eda78a72ce43 (patch)
treeda1b0482d875a48fe95e133346aee4baabcbf7cb /src/pubkey/gost_3410/gost_3410.cpp
parentd4ef447dc8b3b4f40f2ab250b1c364e2f74ccfa4 (diff)
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)
Diffstat (limited to 'src/pubkey/gost_3410/gost_3410.cpp')
-rw-r--r--src/pubkey/gost_3410/gost_3410.cpp40
1 files changed, 0 insertions, 40 deletions
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<byte>
-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<byte> 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) :