Name

Class javax.crypto.SecretKeyFactory

Description

A SecretKeyFactory is used to convert between secret key data formats. For example, you might use a SecretKeyFactory to convert a DES SecretKey into an array of bytes, or to some other representation (a KeySpec). Similarly, a SecretKeyFactory can translate from a KeySpec to a SecretKey. As usual, you can obtain a SecretKeyFactory for a particular algorithm by calling getInstance(). You can translate from a SecretKey to a KeySpec using translateKey(). If you want to create a SecretKey from a corresponding KeySpec, use generateSecret().

Class Definition

public class javax.crypto.SecretKeyFactory
  extends java.lang.Object {

  // Constructors
  protected SecretKeyFactory(SecretKeyFactorySpi, Provider, String);

  // Class Methods
  public static final SecretKeyFactory getInstance(String);
  public static final SecretKeyFactory getInstance(String, String);

  // Instance Methods
  public final SecretKey generateSecret(KeySpec);
  public final String getAlgorithm();
  public final KeySpec getKeySpec(SecretKey, Class);
  public final Provider getProvider();
  public final SecretKey translateKey(SecretKey);
}

See Also

KeySpec, Provider, SecretKey, SecretKeyFactorySpi

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.