23 #include "ndn-cxx/security/impl/openssl.hpp" 33 class Base64Decode::Impl
37 : m_base64(BIO_new(BIO_f_base64()))
38 , m_source(BIO_new(BIO_s_mem()))
42 BIO_set_mem_eof_return(m_source, -1);
45 BIO_push(m_base64, m_source);
50 BIO_free_all(m_base64);
61 : m_impl(make_unique<Impl>())
63 if (!expectNewlineEvery64Bytes)
64 BIO_set_flags(m_impl->m_base64, BIO_FLAGS_BASE64_NO_NL);
70 Base64Decode::preTransform()
82 Base64Decode::convert(
const uint8_t* buf,
size_t size)
84 int wLen = BIO_write(m_impl->m_source, buf, size);
87 if (!BIO_should_retry(m_impl->m_source)) {
99 Base64Decode::finalize()
101 BIO_set_mem_eof_return(m_impl->m_source, 0);
113 Base64Decode::fillOutputBuffer()
118 int rLen = BIO_read(m_impl->m_base64, buffer->data(), buffer->size());
122 if (static_cast<size_t>(rLen) < buffer->size())
123 buffer->erase(buffer->begin() + rLen, buffer->end());
128 unique_ptr<Transform>
131 return make_unique<Base64Decode>(expectNewlineEvery64Bytes);