Yeah, that was it. That had been in the last version I delivered. But, it
seems they lost an entire version of the file. I did not think to check that
since I knew I had put it in their previously.
Thanks Stephen.
I have spent the past couple of days going back and redoing a couple days
worth of work. I have run across what I hope is the last issue. I suspect I
am missing or have one step wrong:
/* most of the error handling removed for brevity */
static int decrypt(char *data_in)
{
BIO *bio_in = NULL;
BIO *b64 = NULL;
RSA *rsa = get_priv_key();
FILE *fp = NULL;
char buf[81] = {'\0'};
unsigned char *rsa_in = NULL;
unsigned char *rsa_out = NULL;
unsigned char pad = RSA_PKCS1_PADDING;
int keysize = 0;
int rsa_inlen = 0;
int rsa_outlen = 0;
int i = 0;
int rt = 0;
b64 = BIO_new(BIO_f_base64());
bio_in = BIO_new_mem_buf(data_in, strlen(data_in));
BIO_push(b64, bio_in);
BIO_write(bio_in, data_in, strlen(data_in));
keysize = RSA_size(rsa);
rsa_in = OPENSSL_malloc(keysize * 2);
rsa_out = OPENSSL_malloc(keysize);
rsa_inlen = BIO_read(bio_in, rsa_in, keysize * 2);
if (rsa_inlen <= 0)
{
rt = -1;
goto end;
}
rsa_outlen = RSA_private_decrypt(rsa_inlen, rsa_in, rsa_out, rsa, pad);
if (rsa_outlen <= 0)
{
rt = -1;
goto end;
}
The RSA_private_decrypt call fails the following errors:
8381:error:2007507E:BIO routines:MEM_WRITE:write to read only
BIO:bss_mem.c:187:
8381:error:0406506C:rsa routines:RSA_EAY_PRIVATE_DECRYPT:data greater than
mod len:rsa_eay.c:489:
rsa_inlen is set to 344
If anyone can shed any insight on what I may have missed. I would be very
grateful..
Thanks!
On Jan 23, 2008 2:15 PM, Dr. Stephen Henson <[EMAIL PROTECTED]> wrote:
> On Wed, Jan 23, 2008, John T. Cox wrote:
>
> > I generate a key pair in another area but now when the code tries to
> load
> > the private key there is an error.
> >
> > 24449:error:0906B072:PEM routines:PEM_get_EVP_CIPHER_INFO:unsupported
> > encryption:pem_lib.c:481:
> >
>
> http://www.openssl.org/support/faq.html#PROG8
>
> Steve.
> --
> Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
> OpenSSL project core developer and freelance consultant.
> Homepage: http://www.drh-consultancy.demon.co.uk
> ______________________________________________________________________
> OpenSSL Project http://www.openssl.org
> User Support Mailing List [email protected]
> Automated List Manager [EMAIL PROTECTED]
>
--
==============================================================================
John T. Cox
e-mail [EMAIL PROTECTED]
www http://members.iglou.com/vampire
==============================================================================