<div dir="ltr"><div><div>Hi,</div><div><br></div><div>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:</div><div><br></div><div><br></div><div>echo 'text_to_cypher' | openssl enc -e -des-ede3-cbc -k 'b2aec78eb50e04f2a60b9efa20b82c903e3cad4f3bd2027g' -iv 00000000 -nosalt | openssl enc -base64</div><div><br></div><div><br></div><div>But I don't get the same result as the one I get in Java using Cipher:</div><div><br></div><div>private final byte [] IV = {0, 0, 0, 0, 0, 0, 0, 0};</div><div>.....</div><div>DESedeKeySpec desKeySpec = new DESedeKeySpec(toByteArray(hexKey));</div><div>SecretKey desKey = new SecretKeySpec(desKeySpec.getKey(), "DESede");</div><div><span class="" style="white-space:pre">                   </span></div><div>Cipher desCipher = Cipher.getInstance("DESede/CBC/NoPadding");</div><div>desCipher.init(Cipher.ENCRYPT_MODE, desKey, new IvParameterSpec(IV));</div><div><br></div><div>//text 0 padding to get it multilpe of 8</div><div><br></div><div>byte[] ciphertext = desCipher.doFinal(cleartext);</div><div>new String(Base64.encodeBase64(ciphertext), "UTF-8");</div><div><br></div><div><br></div><div><br></div><div>Could anyone point me to what I am doing worng in this command line call?</div><div><br></div><div>Thanks in advance.</div></div>-- <br><div class="gmail_signature">David</div>
</div>