I was also pointed to this document by an other member privately
http://www.openssl.org/docs/crypto/d2i_X509.html
and it did not help much
--Smith
On Tue, 7 Sep 2004 13:12:16 -0700, Smith Baylor <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am using C as the programming language and MySQL as the db.
>
> unsigned char *cert_data;
>
> Instead of storing in PEM format directly, I am storing it in base64
> format - I believe this is more safer - feel free to prove me
> otherwise.
>
> Once I store the cert_data value, I also pad this with '\0' - string terminator.
>
> I get something like this at the end of the encoding:
> TGZ3am0wTDNjeTN3PT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
> ����7HZm�
>
> which the db insert or update commands don't like.
>
> /Shivaram
>
>
>
>
> ----- Original Message -----
> From: Carlos Roberto Zainos H <[EMAIL PROTECTED]>
> Date: Tue, 7 Sep 2004 12:36:44 -0500 (CDT)
> Subject: Re: storing PEM encoded certs in database
> To: [EMAIL PROTECTED]
>
> Hi
> I'm not an expert, but I think that could be some different depending
> on the DBMS and the driver connection being used.
>
> For example, I'm using Oracle DB 10g with ODBC based client connection
> to the DB.
>
> I'm storing PEM certificates making a copy of it to a buffer and then
> storing it into the DB via INSERT with the apropiate convertions:
>
> unsigned char cert[2*1024];
> BIO *buf;
>
> buf = BIO_new (BIO_s_mem());
> res = PEM_write_bio_X509(buf, xreq);//xreq is the X509 cert
>
> longitud = sizeof(cert);
> res = BIO_read(buf, cert, (int)longitud);
> cert[res]='\0';
> //executing the INSERT via exec_sql_comm(sentence) function, where
> sentence = "insert into certificados
> (estadocer,fechacaducidad,numserie,certificado) values
> ('V',to_date('%s','YYYY-MM-DD HH24:MI:SS'),'%i','%s')",fecha_cad,
> num_serie, cert)"
> Holpe this helps.
> Zainos
>
> Smith Baylor <[EMAIL PROTECTED]> wrote:
>
> ________________________________
> Do You Yahoo!?
> Yahoo! Net: La mejor conexi�n a internet y 25MB extra a tu correo por
> $100 al mes.
>
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]