Name

Class javax.crypto.spec.DESKeySpec

Description

This class represents a key that is used with a DES symmetric cipher. This class is useful for converting between byte arrays and DES SecretKeys:

  • To convert from a byte array to a SecretKey, construct a DESKeySpec from the byte array. Then use SecretKeyFactory’s generateSecret() to create the SecretKey.

  • To convert from a DES SecretKey to a DESKeySpec, give the SecretKey to SecretKeyFactory’s translateKey().

Class Definition

public class javax.crypto.spec.DESKeySpec
  extends java.lang.Object
  implements java.security.spec.KeySpec {

  // Constructors
  public DESKeySpec(byte[]);
  public DESKeySpec(byte[], int);

  // Class Methods
  public static boolean isParityAdjusted(byte[], int);
  public static boolean isWeak(byte[], int);

  // Instance Methods
  public byte[] getKey();
}

See Also

SecretKeyFactory

Get Java Cryptography now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.