R
Roland Schmitt
Hello,
i have a problem with decryption with the openssl module of ruby.
I try to decrypt a message which is encrypted by another java program.
I have the initialization vector and the key, and I know that the algorithm is Triple-DES with CBC.
What i try is this:
iv = ...
key = ...
cipher = Cipher.new("DES-EDE3-CBC")
cipher.decrypt(key, iv)
cipher.key = key
out = cipher.update(text)
puts("\n\nResult: " + out)
out << cipher.final()
What i get is an exception "final': bad decrypt (OpenSSL::CipherError)" in the cipher.final() line.
But the output from puts() before the cipher.final() is:
"zó‚INý±This is the message number ".
So, there a 8 bytes in front of the cleartext that seem not decrypted, but one byte at the end is missing, e.g. the message number "1".
To me it shows that the key, iv and algorithm is correct, but what i am missing?
Regards,
Roland
________________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt neu bei WEB.DE FreeMail: http://freemail.web.de/?mc=021193
i have a problem with decryption with the openssl module of ruby.
I try to decrypt a message which is encrypted by another java program.
I have the initialization vector and the key, and I know that the algorithm is Triple-DES with CBC.
What i try is this:
iv = ...
key = ...
cipher = Cipher.new("DES-EDE3-CBC")
cipher.decrypt(key, iv)
cipher.key = key
out = cipher.update(text)
puts("\n\nResult: " + out)
out << cipher.final()
What i get is an exception "final': bad decrypt (OpenSSL::CipherError)" in the cipher.final() line.
But the output from puts() before the cipher.final() is:
"zó‚INý±This is the message number ".
So, there a 8 bytes in front of the cleartext that seem not decrypted, but one byte at the end is missing, e.g. the message number "1".
To me it shows that the key, iv and algorithm is correct, but what i am missing?
Regards,
Roland
________________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt neu bei WEB.DE FreeMail: http://freemail.web.de/?mc=021193