# Uses of Interface
javax.crypto.SecretKey

Packages that use SecretKey
Package
Description
java.security
Provides the classes and interfaces for the security framework.
javax.crypto
Provides the classes and interfaces for cryptographic operations.
javax.crypto.interfaces
Provides interfaces for Diffie-Hellman keys as defined in RSA Laboratories' PKCS #3.
javax.crypto.spec
Provides classes and interfaces for key specifications and algorithm parameter specifications.
javax.security.auth.kerberos
This package contains utility classes related to the Kerberos network authentication protocol.

## Uses of SecretKey in java.security

Methods in java.security that return SecretKey
Modifier and Type
Method
Description
`SecretKey`
KeyStore.SecretKeyEntry.`getSecretKey()`
Gets the `SecretKey` from this entry.
Constructors in java.security with parameters of type SecretKey
Modifier
Constructor
Description
``
`SecretKeyEntry(SecretKey secretKey)`
Constructs a `SecretKeyEntry` with a `SecretKey`.
``
`SecretKeyEntry(SecretKey secretKey, Set<KeyStore.Entry.Attribute> attributes)`
Constructs a `SecretKeyEntry` with a `SecretKey` and associated entry attributes.

## Uses of SecretKey in javax.crypto

Methods in javax.crypto that return SecretKey
Modifier and Type
Method
Description
`SecretKey`
KEM.Decapsulator.`decapsulate(byte[] encapsulation)`
The key decapsulation function.
`SecretKey`
KEM.Decapsulator.`decapsulate(byte[] encapsulation, int from, int to, String algorithm)`
The key decapsulation function.
`SecretKey`
KDF.`deriveKey(String alg, AlgorithmParameterSpec derivationSpec)`
Derives a key, returned as a `SecretKey` object.
`SecretKey`
KEMSpi.DecapsulatorSpi.`engineDecapsulate(byte[] encapsulation, int from, int to, String algorithm)`
The key decapsulation function.
`protected abstract SecretKey`
KDFSpi.`engineDeriveKey(String alg, AlgorithmParameterSpec derivationSpec)`
Derives a key, returned as a `SecretKey` object.
`protected abstract SecretKey`
KeyGeneratorSpi.`engineGenerateKey()`
Generates a secret key.
`protected abstract SecretKey`
KeyAgreementSpi.`engineGenerateSecret(String algorithm)`
Creates the shared secret and returns it as a secret key object of the requested algorithm type.
`protected abstract SecretKey`
SecretKeyFactorySpi.`engineGenerateSecret(KeySpec keySpec)`
Generates a `SecretKey` object from the provided key specification (key material).
`protected abstract SecretKey`
SecretKeyFactorySpi.`engineTranslateKey(SecretKey key)`
Translates a key object, whose provider may be unknown or potentially untrusted, into a corresponding key object of this secret key factory.
`final SecretKey`
KeyGenerator.`generateKey()`
Generates a secret key.
`final SecretKey`
KeyAgreement.`generateSecret(String algorithm)`
Creates the shared secret and returns it as a `SecretKey` object of the specified algorithm.
`final SecretKey`
SecretKeyFactory.`generateSecret(KeySpec keySpec)`
Generates a `SecretKey` object from the provided key specification (key material).
`SecretKey`
KEM.Encapsulated.`key()`
Returns the `SecretKey`.
`final SecretKey`
SecretKeyFactory.`translateKey(SecretKey key)`
Translates a key object, whose provider may be unknown or potentially untrusted, into a corresponding key object of this secret key factory.
Methods in javax.crypto with parameters of type SecretKey
Modifier and Type
Method
Description
`protected abstract KeySpec`
SecretKeyFactorySpi.`engineGetKeySpec(SecretKey key, Class<?> keySpec)`
Returns a specification (key material) of the given key object in the requested format.
`protected abstract SecretKey`
SecretKeyFactorySpi.`engineTranslateKey(SecretKey key)`
Translates a key object, whose provider may be unknown or potentially untrusted, into a corresponding key object of this secret key factory.
`final KeySpec`
SecretKeyFactory.`getKeySpec(SecretKey key, Class<?> keySpec)`
Returns a specification (key material) of the given key object in the requested format.
`final SecretKey`
SecretKeyFactory.`translateKey(SecretKey key)`
Translates a key object, whose provider may be unknown or potentially untrusted, into a corresponding key object of this secret key factory.
Constructors in javax.crypto with parameters of type SecretKey
Modifier
Constructor
Description
``
`Encapsulated(SecretKey key, byte[] encapsulation, byte[] params)`
Constructs an `Encapsulated` object.

## Uses of SecretKey in javax.crypto.interfaces

Subinterfaces of SecretKey in javax.crypto.interfaces
Modifier and Type
Interface
Description
`interface`
`PBEKey`
The interface to a PBE key.

## Uses of SecretKey in javax.crypto.spec

Classes in javax.crypto.spec that implement SecretKey
Modifier and Type
Class
Description
`class`
`SecretKeySpec`
This class specifies a secret key in a provider-independent fashion.
Methods in javax.crypto.spec that return SecretKey
Modifier and Type
Method
Description
`SecretKey`
HKDFParameterSpec.Expand.`prk()`
Returns the pseudorandom key (PRK).
Methods in javax.crypto.spec that return types with arguments of type SecretKey
Modifier and Type
Method
Description
`List<SecretKey>`
HKDFParameterSpec.Extract.`ikms()`
Returns an unmodifiable `List` of input keying material values in the order they were added.
`List<SecretKey>`
HKDFParameterSpec.ExtractThenExpand.`ikms()`
Returns an unmodifiable `List` of input keying material values in the order they were added.
`List<SecretKey>`
HKDFParameterSpec.Extract.`salts()`
Returns an unmodifiable `List` of salt values in the order they were added.
`List<SecretKey>`
HKDFParameterSpec.ExtractThenExpand.`salts()`
Returns an unmodifiable `List` of salt values in the order they were added.
Methods in javax.crypto.spec with parameters of type SecretKey
Modifier and Type
Method
Description
`HKDFParameterSpec.BuilderPREVIEW`
HKDFParameterSpec.Builder.`addIKM(SecretKey ikm)`
Adds input keying material (IKM) to the builder.
`HKDFParameterSpec.BuilderPREVIEW`
HKDFParameterSpec.Builder.`addSalt(SecretKey salt)`
Adds a salt to the builder.
`static HKDFParameterSpec.ExpandPREVIEW`
HKDFParameterSpec.`expandOnly(SecretKey prk, byte[] info, int length)`
Creates an `Expand` object.

## Uses of SecretKey in javax.security.auth.kerberos

Classes in javax.security.auth.kerberos that implement SecretKey
Modifier and Type
Class
Description
`final class`
`EncryptionKey`
This class encapsulates an EncryptionKey used in Kerberos.
`class`
`KerberosKey`
This class encapsulates a long term secret key for a Kerberos principal.
Methods in javax.security.auth.kerberos that return SecretKey
Modifier and Type
Method
Description
`final SecretKey`
KerberosTicket.`getSessionKey()`
Returns the session key associated with this ticket.