Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

javax.crypto
Class SecretKeyFactory  view SecretKeyFactory download SecretKeyFactory.java

java.lang.Object
  extended byjavax.crypto.SecretKeyFactory

public class SecretKeyFactory
extends java.lang.Object

A secret key factory translates SecretKey objects to and from java.security.spec.KeySpec objects, and can translate between different vendors' representations of SecretKey objects (for security or semantics; whichever applies).

Since:
1.4

Field Summary
private  java.lang.String algorithm
          The name of the algorithm.
private  java.security.Provider provider
          The provider of the implementation.
private static java.lang.String SERVICE
           
private  SecretKeyFactorySpi skfSpi
          The underlying factory implementation.
 
Constructor Summary
protected SecretKeyFactory(SecretKeyFactorySpi skfSpi, java.security.Provider provider, java.lang.String algorithm)
          Create a new secret key factory.
 
Method Summary
 SecretKey generateSecret(java.security.spec.KeySpec keySpec)
          Generate a secret key from a key specification, if possible.
 java.lang.String getAlgorithm()
          Get the algorithm name.
static SecretKeyFactory getInstance(java.lang.String algorithm)
          Create a new secret key factory from the first appropriate instance.
static SecretKeyFactory getInstance(java.lang.String algorithm, java.security.Provider provider)
          Create a new secret key factory from the specified provider.
static SecretKeyFactory getInstance(java.lang.String algorithm, java.lang.String provider)
          Create a new secret key factory from the named provider.
 java.security.spec.KeySpec getKeySpec(SecretKey key, java.lang.Class keySpec)
          Get the key specification from a secret key.
 java.security.Provider getProvider()
          Get the provider of this implementation.
 SecretKey translateKey(SecretKey key)
          Translate a secret key into another form.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVICE

private static final java.lang.String SERVICE
See Also:
Constant Field Values

skfSpi

private SecretKeyFactorySpi skfSpi
The underlying factory implementation.


provider

private java.security.Provider provider
The provider of the implementation.


algorithm

private java.lang.String algorithm
The name of the algorithm.

Constructor Detail

SecretKeyFactory

protected SecretKeyFactory(SecretKeyFactorySpi skfSpi,
                           java.security.Provider provider,
                           java.lang.String algorithm)
Create a new secret key factory.

Method Detail

getInstance

public static final SecretKeyFactory getInstance(java.lang.String algorithm)
                                          throws java.security.NoSuchAlgorithmException
Create a new secret key factory from the first appropriate instance.


getInstance

public static final SecretKeyFactory getInstance(java.lang.String algorithm,
                                                 java.lang.String provider)
                                          throws java.security.NoSuchAlgorithmException,
                                                 java.security.NoSuchProviderException
Create a new secret key factory from the named provider.


getInstance

public static final SecretKeyFactory getInstance(java.lang.String algorithm,
                                                 java.security.Provider provider)
                                          throws java.security.NoSuchAlgorithmException
Create a new secret key factory from the specified provider.


generateSecret

public final SecretKey generateSecret(java.security.spec.KeySpec keySpec)
                               throws java.security.spec.InvalidKeySpecException
Generate a secret key from a key specification, if possible.


getAlgorithm

public final java.lang.String getAlgorithm()
Get the algorithm name.


getKeySpec

public final java.security.spec.KeySpec getKeySpec(SecretKey key,
                                                   java.lang.Class keySpec)
                                            throws java.security.spec.InvalidKeySpecException
Get the key specification from a secret key.


getProvider

public final java.security.Provider getProvider()
Get the provider of this implementation.


translateKey

public final SecretKey translateKey(SecretKey key)
                             throws java.security.InvalidKeyException
Translate a secret key into another form.