Package org.bouncycastle.crypto
Class SymmetricSecretKey
java.lang.Object
org.bouncycastle.crypto.SymmetricSecretKey
- All Implemented Interfaces:
Destroyable
,Key
,SymmetricKey
Basic class describing a secret key implementation. The key will be zeroized explicitly on
garbage collection and is protected from being shared between approved an un-approved threads.
Note: it the module is run under the SecurityManager only invokers with CryptoServicesPermission.FIPS_MODE_EXPORT_SECRET_KEY permission can successfully call the getKeyBytes() method.
-
Constructor Summary
ConstructorsConstructorDescriptionSymmetricSecretKey
(Algorithm algorithm, byte[] bytes) Base constructor.SymmetricSecretKey
(Parameters parameterSet, byte[] bytes) Base constructor for a specific algorithm associated with a parameter set. -
Method Summary
-
Constructor Details
-
SymmetricSecretKey
Base constructor.- Parameters:
algorithm
- the algorithm this secret key is associated with.bytes
- the bytes representing the key's value.
-
SymmetricSecretKey
Base constructor for a specific algorithm associated with a parameter set.- Parameters:
parameterSet
- the parameter set with the algorithm this secret key is associated with.bytes
- the bytes representing the key's value.
-
-
Method Details
-
getAlgorithm
Return the algorithm this secret key is for.- Specified by:
getAlgorithm
in interfaceKey
- Returns:
- the secret keys algorithm.
-
getKeyBytes
public byte[] getKeyBytes()Return the bytes representing this keys value.See CryptoServicesPermission.FIPS_MODE_EXPORT_SECRET_KEY for the permission associated with this method.
- Specified by:
getKeyBytes
in interfaceSymmetricKey
- Returns:
- the bytes making up this key.
-
equals
Description copied from interface:Key
Return true if o is an equivalent key to this. -
hashCode
public int hashCode()Description copied from interface:Key
Return the hashCode for the key. -
destroy
- Specified by:
destroy
in interfaceDestroyable
- Throws:
DestroyFailedException
-
isDestroyed
public boolean isDestroyed()- Specified by:
isDestroyed
in interfaceDestroyable
-