[openssl-users] base64 decode in C

Scott Neugroschl scott_n at xypro.com
Wed Mar 18 17:26:39 UTC 2015

I believe the SSH pubkey is binary data, not ASCII, so strlen() will not work on it if it has embedded NUL chars.
As Dave Thompson suggested, instead of strlen(), use the length returned from BIO_read.

From: openssl-users [mailto:openssl-users-bounces at openssl.org] On Behalf Of Prashant Bapat
Sent: Wednesday, March 18, 2015 8:08 AM
To: openssl-users
Subject: Re: [openssl-users] base64 decode in C

Hi Dave and Walter,

Thanks for our reply.

I'm not doing anything different for the ssh pubkey. I'm able to decode it using the "openssl enc -base64 -d -A" command. But not using the C program.

Attaching my entire code here. After getting the base64 decoded I'm calculating the MD5 sum and printing it. This works for a regular string but not for SSH pubkey.

Thanks again.


On 18 March 2015 at 18:04, Walter H. <Walter.H at mathemainzel.info<mailto:Walter.H at mathemainzel.info>> wrote:

before calling this function,
remove any whitespace;


openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150318/a6cff623/attachment-0001.html>

More information about the openssl-users mailing list