Class DESParameters

java.lang.Object
org.gudy.bouncycastle.crypto.params.KeyParameter
org.gudy.bouncycastle.crypto.params.DESParameters
All Implemented Interfaces:
CipherParameters
Direct Known Subclasses:
DESedeParameters

public class DESParameters extends KeyParameter
  • Field Details

    • DES_KEY_LENGTH

      public static final int DES_KEY_LENGTH
      See Also:
    • N_DES_WEAK_KEYS

      private static final int N_DES_WEAK_KEYS
      See Also:
    • DES_weak_keys

      private static byte[] DES_weak_keys
  • Constructor Details

    • DESParameters

      public DESParameters(byte[] key)
  • Method Details

    • isWeakKey

      public static boolean isWeakKey(byte[] key, int offset)
      DES has 16 weak keys. This method will check if the given DES key material is weak or semi-weak. Key material that is too short is regarded as weak.

      See "Applied Cryptography" by Bruce Schneier for more information.

      Returns:
      true if the given DES key material is weak or semi-weak, false otherwise.
    • setOddParity

      public static void setOddParity(byte[] bytes)
      DES Keys use the LSB as the odd parity bit. This can be used to check for corrupt keys.
      Parameters:
      bytes - the byte array to set the parity on.