h36704 s 00030/00111/00221 d D 1.6 97/12/09 15:24:53 luehe 7 6 c rm ,* e s 00002/00002/00330 d D 1.5 97/11/18 08:49:08 luehe 6 5 c replaced "Architecture" with "Extension" when referring to API Spec & Reference Guide e s 00002/00002/00330 d D 1.4 97/11/17 13:31:21 luehe 5 4 c removed "#ApplA" from anchor reference e s 00000/00009/00332 d D 1.3 97/10/22 15:25:10 luehe 4 3 c removed examples e s 00002/00003/00339 d D 1.2 97/10/10 12:42:08 luehe 3 1 c fixed getProvider javadocs e s 00000/00000/00000 d R 1.2 97/10/09 09:58:18 Codemgr 2 1 c SunPro Code Manager data about conflicts, renames, etc... c Name history : 1 0 security/JCE1.2/earlyaccess/javax.crypto.SecretKeyFactory.html e s 00342/00000/00000 d D 1.1 97/10/09 09:58:17 luehe 1 0 c date and time created 97/10/09 09:58:17 by luehe e u U f e 0 t T I 1
D 3 E 3 I 3 D 7 E 7 I 7 E 7 E 3D 7 All Packages Class Hierarchy This Package Previous Next IndexE 7 I 7 All Packages Class Hierarchy This Package Previous Next Index E 7
java.lang.Object | +----javax.crypto.SecretKeyFactory
Key factories are used to convert keys (opaque
cryptographic keys of type Key
) into key specifications
(transparent representations of the underlying key material), and vice
versa.
Secret key factories only operate on secret (symmetric) keys.
Key factories are bi-directional, i.e., they allow to build an opaque key object from a given key specification (key material), or to retrieve the underlying key material of a key object in a suitable format.
A provider should document the key specifications supported by its
secret key factory.
D 7
For example, the Sun provider SecretKeyFactory
for DES keys
E 7
I 7
For example, the DES SecretKeyFactory
of the Sun provider
E 7
supports DESKeySpec
as a transparent representation of DES
D 7
keys, and the SecretKeyFactory
for DES-EDE keys supports
E 7
I 7
keys, and the DES-EDE SecretKeyFactory
supports
E 7
DESedeKeySpec
as a transparent representation of DES-EDE keys.
D 4
The following is an example of how to use a SecretKeyFactory
to convert secret key data into a SecretKey
object, which can
be used for a subsequent Cipher
operation:
byte[] desKeyData; DESKeySpec desKeySpec = new DESKeySpec(desKeyData); SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); SecretKey secretKey = keyFactory.generateSecret(desKeySpec);E 4 D 7
The methods of SecretKeyFactory
are divided into two
groups:
engineGenerateSecret
is called by generateSecret
.
SecretKey
object from the
provided key specification (key material).
SecretKey
object from the provided key
specification (key material).
SecretKeyFactory
object for the specified
secret key algorithm.
SecretKeyFactory
object for the specified
secret key algorithm from the specified provider.
SecretKeyFactory
object.
D 7 public SecretKeyFactory() E 7 I 7 protected SecretKeyFactory(SecretKeyFactorySpi keyFacSpi, Provider provider) E 7I 7
D 7 public static SecretKeyFactory getInstance(String algorithm) throws NoSuchAlgorithmException E 7 I 7 public static final SecretKeyFactory getInstance(String algorithm) throws NoSuchAlgorithmException E 7
SecretKeyFactory
object for the specified
secret key algorithm. If the
default provider package contains a SecretKeyFactory
subclass for the specified algorithm, an instance of that subclass
is returned. If such a key factory is not available in the default
provider package, other provider packages are searched.
SecretKeyFactory
object for the specified
secret key algorithm.
D 7 public static SecretKeyFactory getInstance(String algorithm, String provider) throws NoSuchAlgorithmException, NoSuchProviderException E 7 I 7 public static final SecretKeyFactory getInstance(String algorithm, String provider) throws NoSuchAlgorithmException, NoSuchProviderException E 7
SecretKeyFactory
object for the specified
secret key algorithm from the specified provider.
SecretKeyFactory
object for the specified
secret key algorithm.
public final Provider getProvider()
SecretKeyFactory
object.
SecretKeyFactory
object,
or null if the provider has not yet been set
E 3
I 3
SecretKeyFactory
object
E 3
D 7 public SecretKey generateSecret(KeySpec keySpec) throws InvalidKeySpecException E 7 I 7 public final SecretKey generateSecret(KeySpec keySpec) throws InvalidKeySpecException E 7
SecretKey
object from the provided key
specification (key material).
protected abstract SecretKey engineGenerateSecret(KeySpec keySpec) throws InvalidKeySpecException
SecretKey
object from the
provided key specification (key material).
D 7 public KeySpec getKeySpec(SecretKey key, Class keySpec) throws InvalidKeySpecException E 7 I 7 public final KeySpec getKeySpec(SecretKey key, Class keySpec) throws InvalidKeySpecException E 7
protected abstract KeySpec engineGetKeySpec(SecretKey key, Class keySpec) throws InvalidKeySpecException
D 7 public SecretKey translateKey(SecretKey key) throws InvalidKeyException E 7 I 7 public final SecretKey translateKey(SecretKey key) throws InvalidKeyException E 7
protected abstract SecretKey engineTranslateKey(SecretKey key) throws InvalidKeyException
D 7 All Packages Class Hierarchy This Package Previous Next IndexE 7 I 7 All Packages Class Hierarchy This Package Previous Next Index E 7 E 1