javax.crypto
public class SecretKeyFactory extends Object
Since: 1.4
See Also: SecretKey
| Constructor Summary | |
|---|---|
| protected | SecretKeyFactory(SecretKeyFactorySpi skfSpi, Provider provider, String algorithm)
Create a new secret key factory.
|
| Method Summary | |
|---|---|
| SecretKey | generateSecret(KeySpec keySpec)
Generate a secret key from a key specification, if possible.
|
| String | getAlgorithm()
Get the algorithm name.
|
| static SecretKeyFactory | getInstance(String algorithm)
Create a new secret key factory from the first appropriate instance.
|
| static SecretKeyFactory | getInstance(String algorithm, String provider)
Create a new secret key factory from the named provider.
|
| static SecretKeyFactory | getInstance(String algorithm, Provider provider)
Create a new secret key factory from the specified provider.
|
| KeySpec | getKeySpec(SecretKey key, Class keySpec)
Get the key specification from a secret key.
|
| Provider | getProvider()
Get the provider of this implementation.
|
| SecretKey | translateKey(SecretKey key)
Translate a secret key into another form.
|
Parameters: skfSpi The underlying factory implementation. provider The provider. algorithm The algorithm name.
Parameters: keySpec The key specification.
Returns: The secret key.
Throws: java.security.InvalidKeySpecException If the key specification cannot be transformed into a secret key.
Returns: The algorithm name.
Parameters: algorithm The algorithm name.
Returns: The appropriate key factory, if found.
Throws: NoSuchAlgorithmException If no provider implements the specified
algorithm. IllegalArgumentException if algorithm is
null or is an empty string.
Parameters: algorithm The algorithm name. provider The provider name.
Returns: The appropriate key factory, if found.
Throws: NoSuchAlgorithmException If the named provider does not implement
the algorithm. NoSuchProviderException If the named provider does not exist. IllegalArgumentException if either algorithm or
provider is null, or if
algorithm is an empty string.
Parameters: algorithm The algorithm name. provider The provider.
Returns: The appropriate key factory, if found.
Throws: NoSuchAlgorithmException If the provider does not implement the
algorithm. IllegalArgumentException if either algorithm or
provider is null, or if
algorithm is an empty string.
Parameters: key The secret key. keySpec The target key specification class.
Returns: The key specification.
Throws: java.security.spec.InvalidKeySpecException If the secret key cannot be transformed into the specified key specification.
Returns: The provider.
Parameters: key The key to translate.
Returns: The translated key.
Throws: java.security.InvalidKeyException If the argument cannot be translated.