<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Howto base64 encode with C/C++ and OpenSSL</title>
	<atom:link href="http://www.ioncannon.net/programming/34/howto-base64-encode-with-cc-and-openssl/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ioncannon.net/programming/34/howto-base64-encode-with-cc-and-openssl/</link>
	<description>Thoughts on Software Development and Engineering</description>
	<lastBuildDate>Thu, 05 Jan 2012 16:35:51 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: trulyliu</title>
		<link>http://www.ioncannon.net/programming/34/howto-base64-encode-with-cc-and-openssl/comment-page-1/#comment-198180</link>
		<dc:creator>trulyliu</dc:creator>
		<pubDate>Wed, 16 Feb 2011 02:37:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.ioncannon.net/uncategorized/34/howto-base64-encode-with-cc-and-openssl/#comment-198180</guid>
		<description>There is a minor mistake in your code:

  char *buff = (char *)malloc(bptr-&gt;length +1);
  memcpy(buff, bptr-&gt;data, bptr-&gt;length);
  buff[bptr-&gt;length] = 0;</description>
		<content:encoded><![CDATA[<p>There is a minor mistake in your code:</p>
<p>  char *buff = (char *)malloc(bptr-&gt;length +1);<br />
  memcpy(buff, bptr-&gt;data, bptr-&gt;length);<br />
  buff[bptr-&gt;length] = 0;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill</title>
		<link>http://www.ioncannon.net/programming/34/howto-base64-encode-with-cc-and-openssl/comment-page-1/#comment-172192</link>
		<dc:creator>Bill</dc:creator>
		<pubDate>Fri, 18 Jun 2010 19:07:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.ioncannon.net/uncategorized/34/howto-base64-encode-with-cc-and-openssl/#comment-172192</guid>
		<description>/*
** returns the length of the b64 decoded buffer, outbuf is set to a pointer
** to new memory containing the result.  This will be null terminated with
** an extra byte.
**
** Caller must free the returned string pointed to in outbuf.
*/
int base64d(const unsigned char *input, int length, char **outbuf) {

  BIO *bio, *b64, *bmem, *decoder;
  char inbuf[512];
  int inlen, readlen = -1;
  BUF_MEM *bptr;
  char * buffer;

  bmem = BIO_new_mem_buf(input, length);
  b64 = BIO_new(BIO_f_base64());
  /* decoder = BIO_new(BIO_s_mem()); */

  decoder = BIO_push(b64, bmem);
  /* BIO_push(decoder, b64); */

  BIO_flush(decoder);
  BIO_get_mem_ptr(decoder, &amp;bptr);

  if (buffer = (char *)malloc(length)) {
    readlen = BIO_read(decoder, buffer, length);
    buffer[readlen] = 0;
  }

  BIO_free_all(decoder);

  *outbuf = buffer;
  return readlen;
}</description>
		<content:encoded><![CDATA[<p>/*<br />
** returns the length of the b64 decoded buffer, outbuf is set to a pointer<br />
** to new memory containing the result.  This will be null terminated with<br />
** an extra byte.<br />
**<br />
** Caller must free the returned string pointed to in outbuf.<br />
*/<br />
int base64d(const unsigned char *input, int length, char **outbuf) {</p>
<p>  BIO *bio, *b64, *bmem, *decoder;<br />
  char inbuf[512];<br />
  int inlen, readlen = -1;<br />
  BUF_MEM *bptr;<br />
  char * buffer;</p>
<p>  bmem = BIO_new_mem_buf(input, length);<br />
  b64 = BIO_new(BIO_f_base64());<br />
  /* decoder = BIO_new(BIO_s_mem()); */</p>
<p>  decoder = BIO_push(b64, bmem);<br />
  /* BIO_push(decoder, b64); */</p>
<p>  BIO_flush(decoder);<br />
  BIO_get_mem_ptr(decoder, &amp;bptr);</p>
<p>  if (buffer = (char *)malloc(length)) {<br />
    readlen = BIO_read(decoder, buffer, length);<br />
    buffer[readlen] = 0;<br />
  }</p>
<p>  BIO_free_all(decoder);</p>
<p>  *outbuf = buffer;<br />
  return readlen;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Scobie</title>
		<link>http://www.ioncannon.net/programming/34/howto-base64-encode-with-cc-and-openssl/comment-page-1/#comment-122712</link>
		<dc:creator>Jon Scobie</dc:creator>
		<pubDate>Tue, 10 Feb 2009 15:03:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.ioncannon.net/uncategorized/34/howto-base64-encode-with-cc-and-openssl/#comment-122712</guid>
		<description>I think you&#039;ll find that you should be using strlen(&quot;YOYO!&quot;) not sizeof as that will return a completely different answer. If you test with &quot;uuencode -m&quot; or &quot;openssl enc&quot; you will see what I mean.</description>
		<content:encoded><![CDATA[<p>I think you&#039;ll find that you should be using strlen(&#034;YOYO!&#034;) not sizeof as that will return a completely different answer. If you test with &#034;uuencode -m&#034; or &#034;openssl enc&#034; you will see what I mean.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amit</title>
		<link>http://www.ioncannon.net/programming/34/howto-base64-encode-with-cc-and-openssl/comment-page-1/#comment-80015</link>
		<dc:creator>Amit</dc:creator>
		<pubDate>Sat, 05 Jul 2008 13:19:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.ioncannon.net/uncategorized/34/howto-base64-encode-with-cc-and-openssl/#comment-80015</guid>
		<description>Hi Subra,

base64 algorithm in itself appends a carriage return and linefeed characters after its &#039;linesize&#039; character and at the end of the test to be encoded. This infact increases the length of the encoded string by about 3%, but this cannot be avoided.</description>
		<content:encoded><![CDATA[<p>Hi Subra,</p>
<p>base64 algorithm in itself appends a carriage return and linefeed characters after its &#039;linesize&#039; character and at the end of the test to be encoded. This infact increases the length of the encoded string by about 3%, but this cannot be avoided.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Subra</title>
		<link>http://www.ioncannon.net/programming/34/howto-base64-encode-with-cc-and-openssl/comment-page-1/#comment-59187</link>
		<dc:creator>Subra</dc:creator>
		<pubDate>Wed, 19 Mar 2008 15:37:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.ioncannon.net/uncategorized/34/howto-base64-encode-with-cc-and-openssl/#comment-59187</guid>
		<description>Hey Carson,

Thanks for the code. But do you have any idea as to why ur function base64 adds a newline (&#039;\n&#039;) character at the end of the string.

Similarly, ut base64 decode function expects a newline character at the end.

Thanks</description>
		<content:encoded><![CDATA[<p>Hey Carson,</p>
<p>Thanks for the code. But do you have any idea as to why ur function base64 adds a newline (&#039;\n&#039;) character at the end of the string.</p>
<p>Similarly, ut base64 decode function expects a newline character at the end.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Antonio</title>
		<link>http://www.ioncannon.net/programming/34/howto-base64-encode-with-cc-and-openssl/comment-page-1/#comment-30768</link>
		<dc:creator>Antonio</dc:creator>
		<pubDate>Tue, 02 Oct 2007 16:52:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.ioncannon.net/uncategorized/34/howto-base64-encode-with-cc-and-openssl/#comment-30768</guid>
		<description>Hi.
I tested your program and it good i like.
Do you have one example to sign a document with openSSL ?

thanks.</description>
		<content:encoded><![CDATA[<p>Hi.<br />
I tested your program and it good i like.<br />
Do you have one example to sign a document with openSSL ?</p>
<p>thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pádraig Brady</title>
		<link>http://www.ioncannon.net/programming/34/howto-base64-encode-with-cc-and-openssl/comment-page-1/#comment-28764</link>
		<dc:creator>Pádraig Brady</dc:creator>
		<pubDate>Thu, 13 Sep 2007 09:54:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.ioncannon.net/uncategorized/34/howto-base64-encode-with-cc-and-openssl/#comment-28764</guid>
		<description>Ha, I just noticed this now after
figuring out myself how to do it:

http://www.pixelbeat.org/programming/lib_crypto.html

Referenced there is a small wrapper library
around libcrypto that uses the same
method you do for base64 encoding
(the lib also has interfaces for digests,
and symmetric and assymetric ciphers).
Note my lib is a little more generalised,
and also more robust in the case of memory exhaustion.

cheers,
Pádraig.</description>
		<content:encoded><![CDATA[<p>Ha, I just noticed this now after<br />
figuring out myself how to do it:</p>
<p><a href="http://www.pixelbeat.org/programming/lib_crypto.html" rel="nofollow">http://www.pixelbeat.org/programming/lib_crypto.html</a></p>
<p>Referenced there is a small wrapper library<br />
around libcrypto that uses the same<br />
method you do for base64 encoding<br />
(the lib also has interfaces for digests,<br />
and symmetric and assymetric ciphers).<br />
Note my lib is a little more generalised,<br />
and also more robust in the case of memory exhaustion.</p>
<p>cheers,<br />
Pádraig.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Howto base64 decode with C/C++ and OpenSSL @ IONCANNON</title>
		<link>http://www.ioncannon.net/programming/34/howto-base64-encode-with-cc-and-openssl/comment-page-1/#comment-4437</link>
		<dc:creator>Howto base64 decode with C/C++ and OpenSSL @ IONCANNON</dc:creator>
		<pubDate>Wed, 28 Feb 2007 13:27:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.ioncannon.net/uncategorized/34/howto-base64-encode-with-cc-and-openssl/#comment-4437</guid>
		<description>[...] Someone asked for an example of decoding with OpenSSL on the Howto base64 encode with C/C++ and OpenSSL post. So here it is:  #include &lt;string.h&gt; [...]</description>
		<content:encoded><![CDATA[<p>[...] Someone asked for an example of decoding with OpenSSL on the Howto base64 encode with C/C++ and OpenSSL post. So here it is:  #include &lt;string.h&gt; [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: offir</title>
		<link>http://www.ioncannon.net/programming/34/howto-base64-encode-with-cc-and-openssl/comment-page-1/#comment-3832</link>
		<dc:creator>offir</dc:creator>
		<pubDate>Tue, 20 Feb 2007 15:44:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.ioncannon.net/uncategorized/34/howto-base64-encode-with-cc-and-openssl/#comment-3832</guid>
		<description>Can you Plz publish a parallel function for Base64 decoding?</description>
		<content:encoded><![CDATA[<p>Can you Plz publish a parallel function for Base64 decoding?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: carson</title>
		<link>http://www.ioncannon.net/programming/34/howto-base64-encode-with-cc-and-openssl/comment-page-1/#comment-2922</link>
		<dc:creator>carson</dc:creator>
		<pubDate>Thu, 08 Feb 2007 15:16:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.ioncannon.net/uncategorized/34/howto-base64-encode-with-cc-and-openssl/#comment-2922</guid>
		<description>Sorry about that. I believe somewhere along the line an upgrade to the blog software converted some of the code into html. It should be good now.</description>
		<content:encoded><![CDATA[<p>Sorry about that. I believe somewhere along the line an upgrade to the blog software converted some of the code into html. It should be good now.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic page generated in 0.299 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-01-17 08:45:55 -->

