aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/rw
diff options
context:
space:
mode:
Diffstat (limited to 'src/pubkey/rw')
-rw-r--r--src/pubkey/rw/rw.cpp12
-rw-r--r--src/pubkey/rw/rw.h5
2 files changed, 11 insertions, 6 deletions
diff --git a/src/pubkey/rw/rw.cpp b/src/pubkey/rw/rw.cpp
index 259e53a26..72fa29afa 100644
--- a/src/pubkey/rw/rw.cpp
+++ b/src/pubkey/rw/rw.cpp
@@ -57,12 +57,20 @@ RW_PrivateKey::RW_PrivateKey(RandomNumberGenerator& rng,
e = exp;
p = random_prime(rng, (bits + 1) / 2, e / 2, 3, 4);
q = random_prime(rng, bits - p.bits(), e / 2, ((p % 8 == 3) ? 7 : 3), 8);
- d = inverse_mod(e, lcm(p - 1, q - 1) >> 1);
- PKCS8_load_hook(rng, true);
+ n = p * q;
if(n.bits() != bits)
throw Self_Test_Failure(algo_name() + " private key generation failed");
+
+ d = inverse_mod(e, lcm(p - 1, q - 1) >> 1);
+ d1 = d % (p - 1);
+ d2 = d % (q - 1);
+ c = inverse_mod(q, p);
+
+ core = IF_Core(rng, e, n, d, p, q, d1, d2, c);
+
+ gen_check(rng);
}
/*
diff --git a/src/pubkey/rw/rw.h b/src/pubkey/rw/rw.h
index d2411d630..efdca04e7 100644
--- a/src/pubkey/rw/rw.h
+++ b/src/pubkey/rw/rw.h
@@ -57,10 +57,7 @@ class BOTAN_DLL RW_PrivateKey : public RW_PublicKey,
RW_PrivateKey(const AlgorithmIdentifier& alg_id,
const MemoryRegion<byte>& key_bits,
RandomNumberGenerator& rng) :
- IF_Scheme_PrivateKey(alg_id, key_bits)
- {
- PKCS8_load_hook(rng);
- }
+ IF_Scheme_PrivateKey(rng, alg_id, key_bits) {}
RW_PrivateKey(RandomNumberGenerator& rng,
const BigInt& p, const BigInt& q,