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

2015-11-25 Thread David García
Exactly, that's my point, I have to integrate with a third party API, so I can't do anything else but to send the ciphered text as expected. Anyway, thanks for your explanation on this issue, I'll take it into account and try to contact third party support team. Thanks. 2015-11-25 11:23

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

2015-11-25 Thread Viktor Dukhovni
On Wed, Nov 25, 2015 at 09:18:15AM +0100, David García wrote: > H6cr2yN8oWV6AUY/JlknQw== Decrypting in ECB mode you get: $ echo H6cr2yN8oWV6AUY/JlknQw== | openssl base64 -d | openssl enc -d -des-ede3 -K 'b2aec78eb50e05f2a60b9efa20b82c903e6cad4f3bd2027b' -nopad |

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

2015-11-25 Thread David García
Viktor, you pointed me to the right way. I was missing the -nopad flag in the openssl command. I don't need to do the padding through the cipher algorithm because I do the 0 padding manually before executing the ciphering. Now it matches. This is the command I am using (for this manual example I

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

2015-11-25 Thread Viktor Dukhovni
On Wed, Nov 25, 2015 at 11:14:48AM +0100, David García wrote: > Viktor, you pointed me to the right way. I was missing the -nopad flag in > the openssl command. Not using padding is fragile and can lead to subtle data corruption. Perhaps not padding is safe and correct in your case, but I am

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

2015-11-25 Thread David García
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

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

2015-11-24 Thread Jay Foster
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

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

2015-11-24 Thread David García
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 : > On Tue, Nov 24, 2015 at 05:55:42PM +0100, David García wrote: > > > openssl enc -e -des-ede3-cbc -in myfile.txt -k > >

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

2015-11-24 Thread David García
Sorry, still not getting the same result, now with the command: echo 005863330 | openssl enc -e -des-ede3-cbc -K 'b2aec78eb50e05f2a60b9efa20b82c903e6cad4f3bd2027b' -iv -nosalt | openssl enc -base64 I get: H6cr2yN8oWXn2RxiDqnXLg== but I should get: H6cr2yN8oWUVY3a6/Vaaow== BTW I get

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

2015-11-24 Thread Viktor Dukhovni
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 -nosalt | > openssl enc -base64 Please read Michael's message carefully. Note the comment about "-k" vs. "-K"

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

2015-11-24 Thread Viktor Dukhovni
On Tue, Nov 24, 2015 at 06:12:59PM +0100, 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 -nosalt | > openssl enc -base64 Please also read

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

2015-11-24 Thread David García
I am sorry, I pasted an invalid key I was playing with to check some other things. Next, the real key and now reading the value from a file instead from echo (BTW I am using a linux terminal): openssl enc -e -des-ede3-cbc -in myfile.txt -k 'b2aec78eb50e05f2a60b9efa20b82c903e6cad4f3bd2027b' -iv

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

2015-11-24 Thread David García
Hi, I am trying to use openssl command line tool for des-ede3-cbc encryption, but it does not mach with the one I have in Java (and that I know that works ok). I try to generate a des-ede3-cbc encryption with an IV = 0,0,0,0,0,0,0,0. Then I launch following command: echo 'text_to_cypher' |

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

2015-11-24 Thread Michael Wojcik
> echo 'text_to_cypher' | openssl enc -e -des-ede3-cbc -k > 'b2aec78eb50e04f2a60b9efa20b82c903e3cad4f3bd2027g' -iv -nosalt | > openssl enc -base64 That echo command will append a LF (x'0a') byte (if this is a conventional UNIX or Linux system, or Cygwin, etc, and you're running under