RE: d2i_RSAPublicKey doesn't work

2005-07-22 Thread Frédéric Donnat
< 0) /* error */ But i think you have to free the memory using OPENSSSL_free(). Regards, fred -Original Message- From: Edward Chan [mailto:[EMAIL PROTECTED] Sent: Thu 7/21/2005 8:08 PM To: openssl-users@openssl.org Cc: Subject: RE: d2i_RSAPublicKey doesn

RE: d2i_RSAPublicKey doesn't work

2005-07-21 Thread Edward Chan
Horray...that is it. Thanks!!! > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Edward Chan > Sent: Thursday, July 21, 2005 11:00 AM > To: openssl-users@openssl.org > Subject: RE: d2i_RSAPublicKey doesn't work > > S

Re: d2i_RSAPublicKey doesn't work

2005-07-21 Thread Dr. Stephen Henson
On Thu, Jul 21, 2005, Edward Chan wrote: > So I need to save buf to a tmp first like with d2i_RSAPublicKey? > > Like this: > > int len = i2d_RSAPublicKey(rsa, 0); > unsigned char* buf = new unsigned char[len]; > unsigned char* tmp = buf; > i2d_RSAPublicKey(rsa, &tmp); > > // now use buf to dec

RE: d2i_RSAPublicKey doesn't work

2005-07-21 Thread Edward Chan
> From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Dr. > Stephen Henson > Sent: Thursday, July 21, 2005 10:23 AM > To: openssl-users@openssl.org > Subject: Re: d2i_RSAPublicKey doesn't work > > On Thu, Jul 21, 2005, Edward Chan wrote: &g

Re: d2i_RSAPublicKey doesn't work

2005-07-21 Thread Dr. Stephen Henson
On Thu, Jul 21, 2005, Edward Chan wrote: > The code is basically like this: > > int len = i2d_RSAPublicKey(rsa, 0); > > // allocate buffer > unsigned char* buf = new unsigned char[len]; > > // now call again to DER encode the public key > if (i2d_RSAPublicKey(rsa,

RE: d2i_RSAPublicKey doesn't work

2005-07-21 Thread Edward Chan
turns me null back. Does the code look right? Thanks, Ed > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Dr. > Stephen Henson > Sent: Thursday, July 21, 2005 4:12 AM > To: openssl-users@openssl.org > Subject: Re: d2i_RSAPu

Re: d2i_RSAPublicKey doesn't work

2005-07-21 Thread Dr. Stephen Henson
On Wed, Jul 20, 2005, Edward Chan wrote: > Hmm, well, I guess I assumed i2d_RSAPublicKey() was ok since the RSA key > seems fine (I ran RSA_check_key() on it and it says it is ok). Is there > any reason why i2d_RSAPublicKey() would not be returning me valid data? > Normally only if it is not ca

RE: d2i_RSAPublicKey doesn't work

2005-07-20 Thread Edward Chan
rect? Thanks, Ed > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Dr. > Stephen Henson > Sent: Wednesday, July 20, 2005 5:48 PM > To: openssl-users@openssl.org > Subject: Re: d2i_RSAPublicKey doesn't work >

Re: d2i_RSAPublicKey doesn't work

2005-07-20 Thread Dr. Stephen Henson
On Tue, Jul 19, 2005, Edward Chan wrote: > That part of the code remains the same, and continues to work fine. By > the way, my last code snippet should have been: > > U8* tmp = buf; > RSA* pub = d2i_RSAPublicKey(0, (const U8**)&tmp, len); > > I mistakenly typed *len instead of len. > > Anywa

RE: d2i_RSAPublicKey doesn't work

2005-07-19 Thread Edward Chan
PROTECTED] On Behalf Of Nils Larsch > Sent: Tuesday, July 19, 2005 12:36 AM > To: openssl-users@openssl.org > Subject: Re: d2i_RSAPublicKey doesn't work > > Edward Chan wrote: > > If you're referring to http://www.openssl.org/support/faq.html > > > >

Re: d2i_RSAPublicKey doesn't work

2005-07-19 Thread Nils Larsch
Edward Chan wrote: If you're referring to http://www.openssl.org/support/faq.html 3. How do I read or write a DER encoded buffer using the ASN1 functions? ... The opposite assumes we already have len bytes in buf: unsigned char *p; p = buf; p7 = d2i_PKCS7(NULL, &p, len); At this point p7

RE: d2i_RSAPublicKey doesn't work

2005-07-18 Thread Edward Chan
essage- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Nils Larsch > Sent: Monday, July 18, 2005 1:10 PM > To: openssl-users@openssl.org > Subject: Re: d2i_RSAPublicKey doesn't work > > Edward Chan wrote: > > What am I doing wrong here? I

Re: d2i_RSAPublicKey doesn't work

2005-07-18 Thread Nils Larsch
Edward Chan wrote: What am I doing wrong here? I generate an RSA key. Then I DER encode it. Then try to decode it, but the decode fails. The error says, "error:0D07207B:asn1 encoding routines:ASN1_get_object:header too long" RSA* rsa = RSA_generate_key(2048, RSA_F4, 0, 0); if (rsa) {

d2i_RSAPublicKey doesn't work

2005-07-18 Thread Edward Chan
Title: d2i_RSAPublicKey doesn't work What am I doing wrong here?  I generate an RSA key.  Then I DER encode it.  Then try to decode it, but the decode fails.  The error says, "error:0D07207B:asn1 encoding routines:ASN1_get_object:header too long" RSA* rsa = RSA_generate_key(