Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8573665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:18:12+00:00 2026-06-11T19:18:12+00:00

I use the code below where I use BIO_read from an in-memory-buffer to do

  • 0

I use the code below where I use BIO_read from an in-memory-buffer to do base64 decoding. Sometimes BIO_read returns 0 for the size parameter. I could not yet figure out why that would be happening. Any Ideas?

static std::vector<unsigned char> base64_decode(void *input, int length)
{
    std::vector<unsigned char> result(length, 0);
    BIO *b64, *bmem;

    b64 = BIO_new(BIO_f_base64());
    bmem = BIO_new_mem_buf(input, length);
    bmem = BIO_push(b64, bmem);

    int size = BIO_read(bmem, &result[0], length);
    if (size == 0)
        fprintf(stderr, "Problem\n");
    result.resize(size);

    BIO_free_all(bmem);

    return result;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T19:18:13+00:00Added an answer on June 11, 2026 at 7:18 pm

    I had similar issues with base64 decoding until I understood that base64 can be formatted with newlines or not.

    You should try to normalize your input by removing newline characters and then setting the OpenSSL BIO_FLAGS_BASE64_NO_NL flag on your b64 BIO (see the OpenSSL documentation on b64 BIO).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use code below to send file from ASP.NET Rest Api to client. Sometimes
We use the code below to inject Spring beans with properties from a properties
I use the code below to retrieve a text data from the server in
When I use the code below it doesn't alter the size at all, it
I can use the code below to set the size of the textView frame,
I use R code below to build bubble chart. pdf(file='myfigure.pdf',height=10,width=13) y<-c(123,92,104,23,17,89,13) x<-c(11,45,24,50,18,7,2) size<-c(1236,1067,1176,610,539,864,1026) radius<-sqrt(size/pi)
I use the code below to get records from two tables but I want
I use the code below to get all the categories from the am_category table
I could use this code below on Python 2. I tried it on Python
I I use the code below to strip the www from my (new) domain.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.