[openssl-users] Use of command line openssl.exe

Viktor Dukhovni openssl-users at dukhovni.org
Thu Apr 6 15:10:17 UTC 2017


> On Apr 5, 2017, at 6:23 AM, Marina <Marina.Brusa at fastwebnet.it> wrote:
> 
> I have been requested to fill a field  344 characters long with a crypted
> string.

Why?

> My program uses a command to produce this string (cf.enc.b64),
> starting from a string 16 char long (cf.inp)
> 
>    $ openssl rsautl -encrypt -in cf.inp -out CF.enc -inkey farma-fur.cer -certin -pkcs
>    $ openssl base64 -base64 -e -in cf.enc -out cf.enc.b64
> 
> I get a string with 6 '0x0A', and my length is 350! 

Those are newline characters.  The openssl base64 encoder output is
chunked in lines of 64 characters each.  So for 344 bytes of base64
output you'd expect 6 newlines.

> Is there some parameter to avoid these charachters?

Yes, the "-A" option to "openssl base64" suppresses the newlines.
Your second command should be:

    $ openssl base64 -A -in cf.enc -out cf.enc.b64

The "-e" and "-base64" options are not needed (default behaviour of
"base64").

-- 
	Viktor.



More information about the openssl-users mailing list