History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: JRUBY-1194
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Ola Bini
Reporter: Kurt Werle
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
JRuby

DES encryption is somehow broken

Created: 06/Jul/07 06:47 PM   Updated: 14/Aug/08 04:51 AM
Component/s: OpenSSL
Affects Version/s: JRuby 1.1.1
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. GZip Archive DES_Encoding_Test.tar.gz (3 kb)

Environment: OSX java 1.5

Testcase included: yes


 Description  « Hide
DES encryption should be compatible with ruby and java, but it is not. Please see the included tarball for an easy test.

In short, the following will yield different results if run under jruby than it does under ruby:

IV  = "IVIVIVIV"
        Key = "KEYKEYKE"
        
        Alg = "des"
        
        
        def encrypt(clear_string)
                cipher = OpenSSL::Cipher::Cipher.new(Alg)
                cipher.encrypt(Key, IV)
                cipher.padding = 32
                cipher.key = Key
                cipher.iv = IV
                
                encrypted = cipher.update(clear_string)
                encrypted << cipher.final
    
                return encrypted
        end


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Kurt Werle - 06/Jul/07 06:48 PM
workaround:
Use a java class that works and just make calls to it.

Charles Oliver Nutter - 21/Oct/07 11:13 PM
Assigning OSSL-related bug to Ola.

Charles Oliver Nutter - 12/May/08 02:52 PM
Confirmed still broken in 1.1.2ish trunk. Moving to 1.1.1 series to keep it fresh.

Ola Bini - 12/Aug/08 10:54 AM
This has been fixed on OpenSSL trunk. A simple matter of making the default CBC instead of EBC.