Joseph and Rich: In the previous code I obviated the "len" initialization, but it was initialized; and I used what Rich said. The application did not crashed, but I got this error:
error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag I've not found any documentation about this error. Any help again? Best regards, Herbert | -----Original Message----- | From: [EMAIL PROTECTED] | [mailto:[EMAIL PROTECTED] On Behalf Of Joseph Bruni | Sent: Viernes, 10 de Septiembre de 2004 06:42 PM | To: [EMAIL PROTECTED] | Subject: Re: How to convert a buffer in DER format to a RSA structure? | | It looks like "len" is uninitialized. I'm assuming you've | populated the "buf" structure with the DER-encoded key from | your database. You'll need to set "len" to be the length of | the object retrieved from your database. For example: | | long len; | unsigned char buf[1024]; | RSA* pub_key; | | len = my_read_database(buf,sizeof(buf)); | pub_key = d2i_RSAPublicKey(NULL,buf,len); | | | | | | On Sep 10, 2004, at 4:29 PM, Herbert Skopnik V. wrote: | | > Joseph: | > | > Thanks for the answer, but I've used d2i_RSAPublicKey() and the | > application crashed with a segmentation fault. I'm using | this piece of | > code: | > | > char buf[1024]; | > int len; | > RSA *PubKey; | > | > PubKey = d2i_RSAPublicKey(NULL, (const unsigned char **)&buf, len); | > | > What's wrong? | > | > Best regards, | > | > Herbert | > | > | > | -----Original Message----- | > | From: [EMAIL PROTECTED] | > | [mailto:[EMAIL PROTECTED] On Behalf Of Joseph Bruni | > | Sent: Viernes, 10 de Septiembre de 2004 06:00 PM | > | To: [EMAIL PROTECTED] | > | Subject: Re: How to convert a buffer in DER format to a RSA | > structure? | > | | > | The d2i_* functions will convert from DER-encoded things | to Internal | > | structures. The two you'll probably want are | > | | > | d2i_RSAPrivateKey() | > | d2i_RSAPublicKey() | > | | > | | > | | > | | > | On Sep 10, 2004, at 3:36 PM, Herbert Skopnik V. wrote: | > | | > | > Hi everybody! | > | > | > | > I'm working in a project (transactional switch) which uses RSA | > | > encryption to encrypt part of the transaction data. I'm | > | using RSA keys | > | > in DER format stored in a database and I need to convert | > | this buffer | > | > to a RSA structure, without using files (which is the | > | method I'm using | > | > now). | > | > | > | > Does someone know how this could be accomplished? | > | > | > | > Any help would be really appreciated. | > | > | > | > Best regards, | > | > | > | > Herbert Skopnik V. | > | > Ingeniero de Proyectos | > | > Ingeniería Solem Ltda. | > | > 7 Norte 1094, Viña del Mar, Chile | > | > Fono: +56 (32) 656021 | > | > Fax: +56 (32) 656016 | > | > Email: [EMAIL PROTECTED] | > | > Web: www.solem.cl | > | > | > | > | > | | > | | > | ______________________________________________________________________ | > | OpenSSL Project | > http://www.openssl.org | > | User Support Mailing List | > [EMAIL PROTECTED] | > | Automated List Manager | > [EMAIL PROTECTED] | > | | > | ______________________________________________________________________ | > OpenSSL Project | http://www.openssl.org | > User Support Mailing List | [EMAIL PROTECTED] | > Automated List Manager | [EMAIL PROTECTED] | > | | ______________________________________________________________________ | OpenSSL Project http://www.openssl.org | User Support Mailing List [EMAIL PROTECTED] | Automated List Manager [EMAIL PROTECTED] | ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]