diff options
author | lloyd <[email protected]> | 2008-06-20 19:03:45 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-06-20 19:03:45 +0000 |
commit | 7dde81851bfb6cef78c3480acc2f1c1dedb1f126 (patch) | |
tree | 06f35288c9c08b9f77468c664dbf8a65aaaf2647 /src/nr.cpp | |
parent | 770a9850f1a7c6c65b0316503b99798a6ff910dd (diff) |
Similiar combining transform for the ElGamal, DSA, and NR private key
constructors.
Diffstat (limited to 'src/nr.cpp')
-rw-r--r-- | src/nr.cpp | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/src/nr.cpp b/src/nr.cpp index d8e200d9f..de46abd80 100644 --- a/src/nr.cpp +++ b/src/nr.cpp @@ -56,26 +56,20 @@ u32bit NR_PublicKey::message_part_size() const /************************************************* * Create a NR private key * *************************************************/ -NR_PrivateKey::NR_PrivateKey(const DL_Group& grp, - RandomNumberGenerator& rng) +NR_PrivateKey::NR_PrivateKey(RandomNumberGenerator& rng, + const DL_Group& grp, + const BigInt& x_arg) { group = grp; - x = random_integer(rng, 2, group_q() - 1); + x = x_arg; - PKCS8_load_hook(rng, true); - } - -/************************************************* -* NR_PrivateKey Constructor * -*************************************************/ -NR_PrivateKey::NR_PrivateKey(const DL_Group& grp, const BigInt& x1, - const BigInt& y1) - { - group = grp; - y = y1; - x = x1; - - PKCS8_load_hook(global_state().prng_reference()); + if(x == 0) + { + x = random_integer(rng, 2, group_q() - 1); + PKCS8_load_hook(rng, true); + } + else + PKCS8_load_hook(rng, false); } /************************************************* |