Marek, Thanks a lot. I think I was improperly using memory. After I cleaned up some unused RSA_new, EVP_PKEY_new etc.., it started working. Your test program helped me learn openssl error logging.
One more question before I move to new agenda. Is siglen RSA_size? Should rsa_pv and rsa_pb the same size? Thanks again. Sonia -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Marek Marcola Sent: Monday, July 03, 2006 2:13 PM To: openssl-users@openssl.org Subject: RE: Private Key Type and PEM Length Hello, > This is what I up to, > > $ openssl genrsa -out private.pem 2048 > $ openssl rsa -in private.pem -out public.pem -pubout > > to gen the private & public keys > > pvk_fd = fopen("private.pem","r"); > rsa_pv = PEM_read_RSAPrivateKey(pvk_fd,&rsa_pv,NULL,NULL); > ret = RSA_sign(NID_md5,testString,15,authMsg,siglen,rsa_pv); > > ......... > > pbk_fd = fopen("public.pem","r"); > rsa_pb = PEM_read_RSA_PUBKEY(pbk_fd,&rsa_pb,NULL,NULL); > ret = RSA_verify(NID_md5,testString,15,authMsg,*siglen,rsa_pb); > > By dummping public modulus & exponent from both private and public keys, > they are the same. RSA_sign/verify does not work. What did I miss? This looks good, maybe there are some other problems. I've attached quick test based on this code - maybe this will help. Best regards, -- Marek Marcola <[EMAIL PROTECTED]> ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]