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

Michael Wojcik Michael.Wojcik at microfocus.com
Tue Nov 24 15:28:51 UTC 2015

> echo 'text_to_cypher' | openssl enc -e -des-ede3-cbc -k 'b2aec78eb50e04f2a60b9efa20b82c903e3cad4f3bd2027g' -iv 00000000 -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 one of the standard shells). Do you have that byte in the value of your "cleartext" variable in the Java code? You failed to supply that. (Also, the single-quote characters are unnecessary, unless you're running a very odd shell.)

The value of the -k argument you're passing to "openssl enc" ends with "g", which is not a hexadecimal digit; the rest of the value appears to be hexadecimal. But it's not clear why you're using -k anyway. Perhaps you mean to use -K (uppercase K, with an actual hexadecimal argument)?

Michael Wojcik
Technology Specialist, Micro Focus

More information about the openssl-users mailing list