Top Description Fields Methods
java.security

public Interface PrivateKey

extends AsymmetricKey, Destroyable
Known Direct Subinterfaces
java.security.interfaces.DSAPrivateKey, java.security.interfaces.ECPrivateKey, java.security.interfaces.EdECPrivateKey, java.security.interfaces.RSAPrivateKey, java.security.interfaces.XECPrivateKey, javax.crypto.interfaces.DHPrivateKey
Known Direct Implementers
com.sun.crypto.provider.DHPrivateKey, sun.security.pkcs.PKCS8Key

A private key. The purpose of this interface is to group (and provide type safety for) all private key interfaces.

Note

The specialized private key interfaces extend this interface. See, for example, the DSAPrivateKey interface in java.security.interfaces.

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 PrivateKey is Serializable, implementations should also override java.io.ObjectOutputStream#writeObject(java.lang.Object) to prevent keys that have been destroyed from being serialized.

Authors
Benjamin Renaud, Josh Bloch
Since
1.1
See Also
Key, PublicKey, java.security.cert.Certificate, Signature#initVerify, java.security.interfaces.DSAPrivateKey, java.security.interfaces.RSAPrivateKey, java.security.interfaces.RSAPrivateCrtKey

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 with a previous version of the class.

Method Summary

Inherited from java.security.AsymmetricKey:
getParams
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 with a previous version of the class.

Annotations
@Deprecated
@SuppressWarnings:serial
@Serial