Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You don't need to actually implement PBEWithMD5andDES assuming ruby has a DES implementation. What you need to implement is the key derivation function ( who you get a key out of a password) and then feed that derived key to DES with the appropriate mode and padding.</p> <p>Thankfully, the key derivation function is not particularly security critical in implementation, so you can do it yourself safely enough. According to the <a href="http://tools.ietf.org/html/rfc2898" rel="nofollow">rfc</a>, PBEwithMD5AndDES is actually the PBKDF1 ( a ker derivation function) used with DES in CBC mode . </p> <p>PBKDF1 does not look that hard to implement . Looks like you can do it with a for loop and an md5 call.</p> <p>Note that you may still get some odd results because of the possibility of a different padding scheme being used in Java and Ruby. I assume that the spec one is pkcs 1.5 padding, but at a quick glance, I can't confirm this</p> <blockquote> <p><a href="http://tools.ietf.org/html/rfc2898#section-5.1" rel="nofollow">5.1 PBKDF1</a></p> <p>PBKDF1 applies a hash function, which shall be MD2 [6], MD5 [19] or SHA-1 [18], to derive keys. The length of the derived key is bounded<br> by the length of the hash function output, which is 16 octets for MD2 and MD5 and 20 octets for SHA-1. PBKDF1 is compatible with the key<br> derivation process in PKCS #5 v1.5.</p> <p>PBKDF1 is recommended only for compatibility with existing<br> applications since the keys it produces may not be large enough for<br> some applications.</p> <p>PBKDF1 (P, S, c, dkLen)</p> <p>Options: Hash underlying hash function</p> <p>Input: P password, an octet string S salt, an eight-octet string c iteration count, a positive integer dkLen intended length in octets of derived key, a positive integer, at most 16 for MD2 or MD5 and 20 for SHA-1</p> <p>Output: DK derived key, a dkLen-octet string</p> <p>Steps:</p> <pre><code> 1. If dkLen &gt; 16 for MD2 and MD5, or dkLen &gt; 20 for SHA-1, output "derived key too long" and stop. 2. Apply the underlying hash function Hash for c iterations to the concatenation of the password P and the salt S, then extract the first dkLen octets to produce a derived key DK: T_1 = Hash (P || S) , T_2 = Hash (T_1) , ... T_c = Hash (T_{c-1}) , DK = Tc&lt;0..dkLen-1&gt; 3. Output the derived key DK. </code></pre> </blockquote>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload