Boost C++ Libraries: Ticket #5624: base64 encode/decode https://svn.boost.org/trac10/ticket/5624 <pre class="wiki">//typedefs typedef boost::archive::iterators::istream_iterator&lt;char&gt; boost_istream_iterator; typedef boost::archive::iterators::ostream_iterator&lt;char&gt; boost_ostream_iterator; typedef boost::archive::iterators::insert_linebreaks&lt; boost::archive::iterators::base64_from_binary&lt; boost::archive::iterators::transform_width&lt;boost_istream_iterator, 6, 8&gt; &gt;, 76 &gt; bin_to_base64; typedef boost::archive::iterators::transform_width&lt; boost::archive::iterators::binary_from_base64&lt; boost::archive::iterators::remove_whitespace&lt;boost_istream_iterator&gt; &gt;, 8, 6 &gt; base64_to_bin; void test() { { std::ifstream ifs("test.a", std::ios_base::in|std::ios_base::binary); std::ofstream ofs("test.b", std::ios_base::out|std::ios_base::binary); std::copy( bin_to_base64(boost_istream_iterator(ifs &gt;&gt; std::noskipws)), bin_to_base64(boost_istream_iterator()), boost_ostream_iterator(ofs) ); } { std::ifstream ifs("test.b", std::ios_base::in|std::ios_base::binary); std::ofstream ofs("test.c", std::ios_base::out|std::ios_base::binary); std::copy( base64_to_bin(boost_istream_iterator(ifs &gt;&gt; std::noskipws)), base64_to_bin(boost_istream_iterator()), boost_ostream_iterator(ofs) ); } } </pre><p> File test.a contain only one byte 0x50 'P'. Exception happen during decoding, the same behaviour repeat for a any ZIP file. For example. Instead file test.a use any valid zip file. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5624 Trac 1.4.3 anonymous Tue, 21 Jun 2011 13:32:05 GMT <link>https://svn.boost.org/trac10/ticket/5624#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5624#comment:1</guid> <description> <p> File test.a contain only one byte 0x50 'P'. Exception happen during decoding, the same behaviour repeated for a any ZIP file. For example. Use instead file test.a any valid zip file. </p> </description> <category>Ticket</category> </item> <item> <author>nen777w@…</author> <pubDate>Thu, 23 Jun 2011 13:57:03 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5624#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5624#comment:2</guid> <description> <p> If it may help. The workaround code and example how to use you can find here: <a class="ext-link" href="http://rsdn.ru/forum/cpp.applied/4317966.1.aspx"><span class="icon">​</span>http://rsdn.ru/forum/cpp.applied/4317966.1.aspx</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Dave Abrahams</dc:creator> <pubDate>Wed, 21 Nov 2012 19:45:19 GMT</pubDate> <title>owner changed https://svn.boost.org/trac10/ticket/5624#comment:3 https://svn.boost.org/trac10/ticket/5624#comment:3 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Dave Abrahams</span> to <span class="trac-author">jeffrey.hellrung</span> </li> </ul> Ticket Robert Ramey Wed, 21 Nov 2012 19:51:30 GMT owner, status changed https://svn.boost.org/trac10/ticket/5624#comment:4 https://svn.boost.org/trac10/ticket/5624#comment:4 <ul> <li><strong>owner</strong> changed from <span class="trac-author">jeffrey.hellrung</span> to <span class="trac-author">Robert Ramey</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket Dave Abrahams Wed, 21 Nov 2012 22:41:35 GMT owner, status changed https://svn.boost.org/trac10/ticket/5624#comment:5 https://svn.boost.org/trac10/ticket/5624#comment:5 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Robert Ramey</span> to <span class="trac-author">jeffrey.hellrung</span> </li> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">new</span> </li> </ul> Ticket Dave Abrahams Wed, 21 Nov 2012 22:42:21 GMT owner, component changed https://svn.boost.org/trac10/ticket/5624#comment:6 https://svn.boost.org/trac10/ticket/5624#comment:6 <ul> <li><strong>owner</strong> changed from <span class="trac-author">jeffrey.hellrung</span> to <span class="trac-author">Robert Ramey</span> </li> <li><strong>component</strong> <span class="trac-field-old">iterator</span> → <span class="trac-field-new">serialization</span> </li> </ul> Ticket Robert Ramey Tue, 18 Feb 2014 17:52:07 GMT <link>https://svn.boost.org/trac10/ticket/5624#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5624#comment:7</guid> <description> <p> Is this still an issue. I think I addressed this. Note that the test_iterators_base64 explicitly tests the situation where the number of characters to be rendered is only 1. Please double check and let me know. If I don't get any response for a while, I'll close this ticket. </p> <p> Robert Ramey </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Thu, 06 Mar 2014 18:27:36 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/5624#comment:8 https://svn.boost.org/trac10/ticket/5624#comment:8 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket