Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>PBEWith&lt;Hash>AndTripleDES Requires "Unlimited Strength" Policy</h2> <p>This algorithm uses a 168-bit key (although due to vulnerabilities, it has an effective strength of 112 bits). To use a symmetric key of that length, you need the <a href="http://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html" rel="nofollow noreferrer">"unlimited strength jurisdiction policy"</a> installed in your Java runtime.</p> <p>An "<em>Illegal</em> key size" message indicates the key length is not permitted by policy; if the key length is incorrect for the algorithm, the SunJCE provider uses the message, "<em>Wrong</em> key size".</p> <h2>Don't Use PBEWith&lt;Hash>AndTripleDES</h2> <p>Note that "PBEWithMD5AndTripleDES" is a bad algorithm to use.</p> <p>Password-based encryption generally follows <a href="http://tools.ietf.org/html/rfc2898" rel="nofollow noreferrer">PKCS #5.</a> It defines an encryption scheme for DES (or RC2) called PBES1. Because PBES1 was designed to generate 64-bit (or less) keys, Oracle has created a proprietary extension to generate longer keys. It hasn't been exposed to the same scrutiny that PKCS #5 has, and if you need to inter-operate with any other platform, you'll have to <a href="http://www.docjar.com/html/api/com/sun/crypto/provider/PBECipherCore.java.html#261" rel="nofollow noreferrer">dig into the source code</a> to find out how the key and initialization vector are derived.</p> <p>It's also strange that the initialization vector is derived from the password. The purpose of an IV is to create different cipher texts each time a given plain text is encrypted with the same key. If the IV is generated from the key, this purpose is defeated. The key-derivation algorithm used by PBES1 avoids this by incorporating a "salt" that is supposed to be different each time the password is used. But, it could be easy to screw this up; providing an IV directly to the cipher initialization is more conventional, and makes it more obvious what is happening.</p> <h2>Use PBKDF2 Instead</h2> <p>PKCS #5 also defines an key-derivation algorithm called PBKDF2 that is now supported by Java. It provides superior security to PBES1 because the initialization vector and any other parameters required by the cipher are <em>not</em> derived from the password, but are selected independently.</p> <p>Here's <a href="https://stackoverflow.com/a/992413/3474">an example with PBKDF2,</a> using AES. If you can't follow the recommendation to update to AES, the example can be applied to DESede by using a key length of 192, and changing occurrences "AES" to "DESede".</p> <h2>TDEA Keying Options</h2> <p>There are three keying options that can be used with TDEA ("Triple DES" or "DESede"). They take 64-, 128-, or 192-bit keys (including parity bits), depending on the option. </p> <p>The key sizes accepted by the TDEA implementation depend on the provider; a few require you to form a 192-bit key, even if you are using the 56-bit key option which is effectively DES instead of TDEA. Most implementations will take 16 or 24 bytes as a key.</p> <p>Only the three-key option (168 bits, or 192 bits with parity) can be considered "strong encryption". It has 112 bits of effective strength.</p>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. 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