Re: Base64 encoding with BIO_new_mem_buf

2007-07-13 Thread Jim Fox
One other issue though the base64 encoded string contains new line character at the end. is there a way through the api to not include it. It is characteristic of openssl to insert linebreaks in both base64 and PEM encodings --- and to require them when it decodes data. If for some r

Re: Base64 encoding with BIO_new_mem_buf

2007-07-13 Thread k b
One other issue though the base64 encoded string contains new line character at the end. is there a way through the api to not include it. From: "k b" <[EMAIL PROTECTED]> Reply-To: openssl-users@openssl.org To: openssl-users@openssl.org Subject: Re: Base64 encoding with BIO_

Re: Base64 encoding with BIO_new_mem_buf

2007-07-12 Thread k b
that was indeed the problem, a read only buffer. Thanks Jim ! From: Jim Fox <[EMAIL PROTECTED]> Reply-To: openssl-users@openssl.org To: openssl-users@openssl.org Subject: Re: Base64 encoding with BIO_new_mem_buf Date: Thu, 12 Jul 2007 11:21:28 -0700 (PDT) And yeah even with the c

Re: Base64 encoding with BIO_new_mem_buf

2007-07-12 Thread Jim Fox
And yeah even with the correct size it still doesn't work. The BIO_new_mem_buf creates a read-only buffer. If you want to write to memory use bio = BIO_new(BIO_s_mem()); and use BIO_get_mem_ptr to get a pointer to the buffer. Jim

Re: Base64 encoding with BIO_new_mem_buf

2007-07-12 Thread k b
); printf("[%s]\n", enc); } And yeah even with the correct size it still doesn't work. here's the output i get from all the printfs $./a.out Bytes Written 4, (null) [] $ From: Jim Fox <[EMAIL PROTECTED]> Reply-To: openssl-users@openssl.org To: openssl-users@opens

Re: Base64 encoding with BIO_new_mem_buf

2007-07-12 Thread Jim Fox
But what i really want is the encoded string in a char buffer. And so i comment out 2 and use 1 instead. As its suppose to write the encoded string into a buffer, but the problem here is pEncBuf is empty even though bytesWritten says it wrote 4 bytes. And i can't explain why it won'

Base64 encoding with BIO_new_mem_buf

2007-07-12 Thread k b
Hi, I'm trying to use BIO to do base64 encoding. but here's the problem in the sample code below, if I comment out like 1 (which uses mem bio) and uncomment 2 (one that uses file bio) everything works and the encoded string is written the std out. Which is good as it tells me that thi