Top Description Fields Methods
javax.crypto

public Interface SecretKey

extends Key, Destroyable
Known Direct Subinterfaces
javax.crypto.interfaces.PBEKey, sun.security.internal.interfaces.TlsMasterSecret
Known Direct Implementers
javax.crypto.spec.SecretKeySpec, com.sun.crypto.provider.DESedeKey, com.sun.crypto.provider.DESKey, com.sun.crypto.provider.PBEKey, sun.security.internal.spec.TlsKeyMaterialSpec

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 the equals and hashCode methods inherited from java.lang.Object, so that secret keys are compared based on their underlying key material and not based on reference. Implementations should override the default destroy and isDestroyed methods from the javax.security.auth.Destroyable 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 override java.io.ObjectOutputStream#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. (The getFormat and getEncoded methods are inherited from the java.security.Key parent interface.)

Author
Jan Luehe
Since
1.4
See Also
SecretKeyFactory, Cipher

Field Summary

Modifier and TypeField and Description
public static final long
serialVersionUID

Hides java.security.Key.serialVersionUID.

Deprecated A serialVersionUID field in an interface is ineffectual. Do not use; no replacement.
The class fingerprint that is set to indicate serialization compatibility since J2SE 1.4.

Method Summary

Inherited from java.security.Key:
getAlgorithmgetEncodedgetFormat
Inherited from javax.security.auth.Destroyable:
destroyisDestroyed

Field Detail

serialVersionUIDback to summary
public static final long serialVersionUID

Hides java.security.Key.serialVersionUID.

Deprecated

A serialVersionUID field in an interface is ineffectual. Do not use; no replacement.

The class fingerprint that is set to indicate serialization compatibility since J2SE 1.4.

Annotations
@Deprecated
@SuppressWarnings:serial