SecretKey (Java SE 9 & JDK 9 ) (original) (raw)
- All Superinterfaces:
[Destroyable](../../javax/security/auth/Destroyable.html "interface in javax.security.auth")
,[Key](../../java/security/Key.html "interface in java.security")
,[Serializable](../../java/io/Serializable.html "interface in java.io")
All Known Subinterfaces:[PBEKey](../../javax/crypto/interfaces/PBEKey.html "interface in javax.crypto.interfaces")
All Known Implementing Classes:[EncryptionKey](../../javax/security/auth/kerberos/EncryptionKey.html "class in javax.security.auth.kerberos")
,[KerberosKey](../../javax/security/auth/kerberos/KerberosKey.html "class in javax.security.auth.kerberos")
,[SecretKeySpec](../../javax/crypto/spec/SecretKeySpec.html "class in javax.crypto.spec")
public interface SecretKey
extends Key, Destroyable
A secret (symmetric) key. The purpose of this interface is to group (and provide type safety for) all secret key interfaces.
Provider implementations of this interface must overwrite theequals
and hashCode
methods inherited fromObject, so that secret keys are compared based on their underlying key material and not based on reference. Implementations should override the default destroy
andisDestroyed
methods from theDestroyable interface to enable sensitive key information to be destroyed, cleared, or in the case where such information is immutable, unreferenced. Finally, since SecretKey
is Serializable
, implementations should also overrideObjectOutputStream.writeObject(java.lang.Object) to prevent keys that have been destroyed from being serialized.
Keys that implement this interface return the string RAW
as their encoding format (see getFormat
), and return the raw key bytes as the result of a getEncoded
method call. (ThegetFormat
and getEncoded
methods are inherited from the Key parent interface.)
Since:
1.4
See Also:
SecretKeyFactory, Cipher
Field Summary
Fields
Modifier and Type Field Description static long serialVersionUID The class fingerprint that is set to indicate serialization compatibility since J2SE 1.4. Method Summary
* ### Methods inherited from interface javax.security.auth.[Destroyable](../../javax/security/auth/Destroyable.html "interface in javax.security.auth") `[destroy](../../javax/security/auth/Destroyable.html#destroy--), [isDestroyed](../../javax/security/auth/Destroyable.html#isDestroyed--)` * ### Methods inherited from interface java.security.[Key](../../java/security/Key.html "interface in java.security") `[getAlgorithm](../../java/security/Key.html#getAlgorithm--), [getEncoded](../../java/security/Key.html#getEncoded--), [getFormat](../../java/security/Key.html#getFormat--)`
Field Detail
* #### serialVersionUID static final long serialVersionUID The class fingerprint that is set to indicate serialization compatibility since J2SE 1.4. See Also: [Constant Field Values](../../constant-values.html#javax.crypto.SecretKey.serialVersionUID)
Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2017, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.