[openssl-users] openssl des-ede3-cbc does not match with Java one

David García garcia.narbona at gmail.com
Wed Nov 25 08:18:15 UTC 2015


Thanks, you are rigth. I did a test with

echo -n 005863330

and

echo 005863330

and the last one adds the new line character.

I also checked that openssl is not adding this new line character. Now with
this command:

echo -n 005863330 | openssl enc -e -des-ede3-cbc -K
'b2aec78eb50e05f2a60b9efa20b82c903e6cad4f3bd2027b' -iv 00000000 -nosalt |
openssl enc -base64

I get:

H6cr2yN8oWV6AUY/JlknQw==

but is not exactly the same result I get for the same input in my Java and
PHP examples. In those ones I get:

H6cr2yN8oWUVY3a6/Vaaow==


In the Java and PHP examples the input data is hardcoded in text:

text "005863330"
key "b2aec78eb50e05f2a60b9efa20b82c903e6cad4f3bd2027b"


Regards.

2015-11-24 18:19 GMT+01:00 Jay Foster <jayf0ster at roadrunner.com>:

> It is very likely that your text file also contains a newline at the end,
> so getting the same result as with the echo command would be expected.  If
> it is indeed the newline that is making the difference, you could try using
> the echo command with the '-n' option to suppress it.
>
> Jay
>
>
> On 11/24/2015 9:12 AM, David García wrote:
>
> Sorry, still not getting the same result, now with the command:
>
> echo 005863330 | openssl enc -e -des-ede3-cbc -K
> 'b2aec78eb50e05f2a60b9efa20b82c903e6cad4f3bd2027b' -iv 00000000 -nosalt |
> openssl enc -base64
>
> I get:
>
> H6cr2yN8oWXn2RxiDqnXLg==
>
> but I should get:
>
> H6cr2yN8oWUVY3a6/Vaaow==
>
>
> BTW I get the same result if the text in the echo is between '' or is read
> from a text file.
>
> 2015-11-24 18:07 GMT+01:00 David García <garcia.narbona at gmail.com>:
>
>> You are right Viktor, that was my problem.
>>
>> Thank you very much for your help Viktor and Michael.
>>
>> 2015-11-24 18:00 GMT+01:00 Viktor Dukhovni < <openssl-users at dukhovni.org>
>> openssl-users at dukhovni.org>:
>>
>>> On Tue, Nov 24, 2015 at 05:55:42PM +0100, David García wrote:
>>>
>>> > openssl enc -e -des-ede3-cbc -in myfile.txt -k
>>> > 'b2aec78eb50e05f2a60b9efa20b82c903e6cad4f3bd2027b' -iv 00000000
>>> -nosalt |
>>> > openssl enc -base64
>>>
>>> Please read Michael's message carefully.  Note the comment about
>>> "-k" vs. "-K" (upper-case).
>>>
>>> --
>>>         Viktor.
>>> _______________________________________________
>>> openssl-users mailing list
>>> To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
>>>
>>
>>
>>
>> --
>> David
>>
>
>
>
> --
> David
>
>
> _______________________________________________
> openssl-users mailing list
> To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
>
>
>
> _______________________________________________
> openssl-users mailing list
> To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
>
>


-- 
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20151125/80c9e393/attachment-0001.html>


More information about the openssl-users mailing list