Skip to content
Snippets Groups Projects
Commit ec5a7abc authored by Niels Möller's avatar Niels Möller
Browse files

Adapted to new pkcs module.

Rev: lib/modules/Crypto/rsa.pike:1.13
parent 9a8eb19b
No related branches found
No related tags found
No related merge requests found
/* $Id: rsa.pike,v 1.12 1997/11/28 10:04:31 nisse Exp $
/* $Id: rsa.pike,v 1.13 1997/11/30 11:58:43 nisse Exp $
*
* Follow the PKCS#1 standard for padding and encryption.
*/
......@@ -6,6 +6,8 @@
#define bignum object(Gmp.mpz)
#define BIGNUM (Gmp.mpz)
import Standards.PKCS;
bignum n; /* modulo */
bignum e; /* public exponent */
bignum d; /* private exponent (if known) */
......@@ -96,13 +98,13 @@ string rsa_unpad(bignum block, int type)
object sign(string message, program h, mixed|void r)
{
return rsa_pad(pkcs.build_digestinfo(message, h()), 1, r)->powm(d, n);
return rsa_pad(Signature.build_digestinfo(message, h()), 1, r)->powm(d, n);
}
int verify(string msg, program h, object sign)
{
// werror(sprintf("msg: '%s'\n", Crypto.string_to_hex(msg)));
string s = pkcs.build_digestinfo(msg, h());
string s = Signature.build_digestinfo(msg, h());
// werror(sprintf("rsa: s = '%s'\n", s));
// werror(sprintf("decrypted: '%s'\n", sign->powm(e, n)->digits(256)));
string s2 = rsa_unpad(sign->powm(e, n), 1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment