Skip to content
Snippets Groups Projects
Commit 7b749e6a authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Added wrappers for get_{d,p,q}().

Rev: lib/modules/Crypto/rsa.pike:1.21
parent e1f62b55
Branches
Tags
No related merge requests found
/* $Id: rsa.pike,v 1.20 2000/05/04 16:04:41 grubba Exp $ /* $Id: rsa.pike,v 1.21 2000/06/13 19:28:10 grubba Exp $
* *
* Follow the PKCS#1 standard for padding and encryption. * Follow the PKCS#1 standard for padding and encryption.
*/ */
...@@ -182,6 +182,42 @@ static class rsa_wrapper ...@@ -182,6 +182,42 @@ static class rsa_wrapper
return res1; return res1;
} }
object get_d()
{
object res1 = _rsa_pike->get_d();
object res2 = BIGNUM(_rsa_c->cooked_get_d(), 256);
if (res1 != res2) {
werror("RSA: get_e() failed!\n");
error(sprintf("res1:%O != res2:%O\n", res1, res2));
}
return res1;
}
object get_p()
{
object res1 = _rsa_pike->get_p();
object res2 = BIGNUM(_rsa_c->cooked_get_p(), 256);
if (res1 != res2) {
werror("RSA: get_p() failed!\n");
error(sprintf("res1:%O != res2:%O\n", res1, res2));
}
return res1;
}
object get_q()
{
object res1 = _rsa_pike->get_q();
object res2 = BIGNUM(_rsa_c->cooked_get_q(), 256);
if (res1 != res2) {
werror("RSA: get_q() failed!\n");
error(sprintf("res1:%O != res2:%O\n", res1, res2));
}
return res1;
}
static void create() static void create()
{ {
werror("RSA: Using rsa_wrapper\n"); werror("RSA: Using rsa_wrapper\n");
...@@ -214,6 +250,21 @@ bignum get_e() ...@@ -214,6 +250,21 @@ bignum get_e()
{ {
return BIGNUM(cooked_get_e(), 256); return BIGNUM(cooked_get_e(), 256);
} }
bignum get_d()
{
return BIGNUM(cooked_get_d(), 256);
}
bignum get_p()
{
return BIGNUM(cooked_get_p(), 256);
}
bignum get_q()
{
return BIGNUM(cooked_get_q(), 256);
}
#endif /* !USE_PIKE_RSA && !USE_RSA_WRAPPER && constant(_Crypto._rsa) */ #endif /* !USE_PIKE_RSA && !USE_RSA_WRAPPER && constant(_Crypto._rsa) */
object sign(string message, program h) object sign(string message, program h)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment