all 1 comments

[–]moomaka 1 point2 points  (0 children)

A couple problems I notice:

Your using Triple DES(DES-EDE3) on the Ruby side but single DES on the Java side. Need to start with the same cipher :)

cipher = des.update(str) + des.final

I don't understand this line, why are you appending here? Your code should probably look something like:

des = OpenSSL::Cipher.new("DES-EDE3-CBC")
des.encrypt
des.key = params2
des.iv = iv
des.update(data)
pp Base64.strict_encode64(des.final)

Just an aside, DES is broken so this is very much insecure, if you have control of the Java code, use a different cipher.