The Key interface is the top-level interface for all keys. It defines the functionality shared by all key objects. All keys have three characteristics:
A private key. The purpose of this interface is to group (and provide type safety for) all private key interfaces. <p> Note: The specialized private key interfaces extend this interface. See, for example, the {@code DSAPrivateKey} interface in {@link java.security.interfaces}. <p> Implementations should override the default {@code destroy} and {@code isDestroyed} methods from the {@link 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 {@code PrivateKey} is {@code Serializable}, implementations should also override {@link java.io.ObjectOutputStream#writeObject(java.lang.Object)} to prevent keys that have been destroyed from being serialized.
<p>A public key. This interface contains no methods or constants. It merely serves to group (and provide type safety for) all public key interfaces.