This works for me:
void base64Decode(unsigned char* pIn, int inLen, unsigned char* pOut,
int& outLen)
{
        // create a memory buffer containing base64 encoded data
        BIO* bmem = BIO_new_mem_buf((void*)pIn, inLen);

        // push a Base64 filter so that reading from buffer decodes it
        BIO *bioCmd = BIO_new(BIO_f_base64());
        // we don't want newlines
        BIO_set_flags(bioCmd, BIO_FLAGS_BASE64_NO_NL);
        bmem = BIO_push(bioCmd, bmem);

        int finalLen = BIO_read(bmem, (void*)pOut, outLen);
        BIO_free_all(bmem);
        outLen = finalLen;
}

On Fri, Sep 4, 2009 at 1:37 PM, Nigel Sollars<n...@vx.com> wrote:
> HI all,
>
> I have a working example of Encoding base64 using the BIO methods but
> decrypting a string is being somewhat problematic.  The code in the man page
> for decoding does not work either as the stdin new_fp does not hand off /
> stop listening for input.
>
> The openssl version is 0.9.8i
>
> If anyone could supply a working example I would appreciate it,
>
> Regards
> Nigel
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    openssl-us...@openssl.org
> Automated List Manager                           majord...@openssl.org
>
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to