Bug 674670

Summary: openssl loses base64 data if no newline at the end
Product: [Fedora] Fedora Reporter: Penelope Fudd <bugzilla.redhat.com>
Component: opensslAssignee: Tomas Mraz <tmraz>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 14CC: tmraz
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-07-26 10:50:23 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Penelope Fudd 2011-02-02 21:17:03 UTC
Description of problem:
I'm testing smtp auth login using the command line.  One step is to encode the username and password with "/bin/echo -ne myusername | openssl enc -base64".  The opposite step would be "/bin/echo -ne bXl1c2VybmFtZQ== | openssl enc -d -base64", which doesn't actually produce any output until you remove the '-ne'.

Version-Release number of selected component (if applicable):
openssl-1.0.0c-1.fc14.i686

How reproducible:
Every time

Steps to Reproduce:
1. /bin/echo -ne bXl1c2VybmFtZQ== | openssl enc -d -base64
2.
3.
  
Actual results:
No output

Expected results:
The string 'myusername' should be printed, with no newline.

Additional info:
I got the method from 
http://goodingredients.org/recipe/articles/email3/smtp-testing.rst

Side note: the built-in echo in tcsh doesn't recognize the '-ne', and sends it to stdout.  That caused some frustration until I tried decoding it and the base64 spelled out "-ne myusername".  For testing, use /bin/echo or bash's echo, not tcsh echo.

Comment 1 Penelope Fudd 2011-02-02 21:19:16 UTC
To clarify: openssl doesn't process (ie: throws away) the base64 string unless there's a newline on the end.  I don't recall any spec saying that newlines were required before base64 is valid.

Comment 2 Tomas Mraz 2011-02-02 21:43:44 UTC
You can use the plain base64 command from coreutils that works.

Can you please report the bug upstream by sending it to the upstream bug tracker rt?