aboutsummaryrefslogtreecommitdiffstats
path: root/src/dh.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-09-06 19:48:09 +0000
committerlloyd <[email protected]>2006-09-06 19:48:09 +0000
commite00227828d80f9c9a17ef236586211faa01e4193 (patch)
tree2573533839150184038b18d7789eaef1ee5dd904 /src/dh.cpp
parent7f176fd2259fcb395ca03751f19790eac15bd9ce (diff)
Split PK_Key into Public_Key and Private_Key; these new classes merge in
the interfaces previously included in X509_PublicKey and PKCS8_PrivateKey.
Diffstat (limited to 'src/dh.cpp')
-rw-r--r--src/dh.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/dh.cpp b/src/dh.cpp
index cdcd17e50..23242e5f6 100644
--- a/src/dh.cpp
+++ b/src/dh.cpp
@@ -24,7 +24,15 @@ DH_PublicKey::DH_PublicKey(const DL_Group& grp, const BigInt& y1)
*************************************************/
void DH_PublicKey::X509_load_hook()
{
- check_loaded_public();
+ load_check();
+ }
+
+/*************************************************
+* Return the maximum input size in bits *
+*************************************************/
+u32bit DH_PublicKey::max_input_bits() const
+ {
+ return group_p().bits();
}
/*************************************************
@@ -45,8 +53,7 @@ DH_PrivateKey::DH_PrivateKey(const DL_Group& grp)
const BigInt& p = group_p();
x = random_integer(2 * dl_work_factor(p.bits()));
- PKCS8_load_hook();
- check_generated_private();
+ PKCS8_load_hook(true);
}
/*************************************************
@@ -60,17 +67,21 @@ DH_PrivateKey::DH_PrivateKey(const DL_Group& grp, const BigInt& x1,
x = x1;
PKCS8_load_hook();
- check_loaded_private();
}
/*************************************************
* Algorithm Specific PKCS #8 Initialization Code *
*************************************************/
-void DH_PrivateKey::PKCS8_load_hook()
+void DH_PrivateKey::PKCS8_load_hook(bool generated)
{
if(y == 0)
y = power_mod(group_g(), x, group_p());
core = DH_Core(group, x);
+
+ if(generated)
+ gen_check();
+ else
+ load_check();
}
/*************************************************