aboutsummaryrefslogtreecommitdiffstats
path: root/src/elgamal.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/elgamal.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/elgamal.cpp')
-rw-r--r--src/elgamal.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/elgamal.cpp b/src/elgamal.cpp
index 152aeb4dc..7be0a576b 100644
--- a/src/elgamal.cpp
+++ b/src/elgamal.cpp
@@ -26,7 +26,7 @@ ElGamal_PublicKey::ElGamal_PublicKey(const DL_Group& grp, const BigInt& y1)
void ElGamal_PublicKey::X509_load_hook()
{
core = ELG_Core(group, y);
- check_loaded_public();
+ load_check();
}
/*************************************************
@@ -56,8 +56,7 @@ ElGamal_PrivateKey::ElGamal_PrivateKey(const DL_Group& grp)
x = random_integer(2 * dl_work_factor(group_p().bits()));
- PKCS8_load_hook();
- check_generated_private();
+ PKCS8_load_hook(true);
}
/*************************************************
@@ -71,17 +70,21 @@ ElGamal_PrivateKey::ElGamal_PrivateKey(const DL_Group& grp, const BigInt& x1,
x = x1;
PKCS8_load_hook();
- check_loaded_private();
}
/*************************************************
* Algorithm Specific PKCS #8 Initialization Code *
*************************************************/
-void ElGamal_PrivateKey::PKCS8_load_hook()
+void ElGamal_PrivateKey::PKCS8_load_hook(bool generated)
{
if(y == 0)
y = power_mod(group_g(), x, group_p());
core = ELG_Core(group, y, x);
+
+ if(generated)
+ gen_check();
+ else
+ load_check();
}
/*************************************************