Package java.security

Interface Key

All Superinterfaces:
Serializable
All Known Subinterfaces:
DHPrivateKey, DHPublicKey, DSAPrivateKey, DSAPublicKey, ECPrivateKey, ECPrivateKey, ECPublicKey, ECPublicKey, PBEKey, PrivateKey, PublicKey, RSAMultiPrimePrivateCrtKey, RSAPrivateCrtKey, RSAPrivateKey, RSAPublicKey, SecretKey
All Known Implementing Classes:
BCDHPrivateKey, BCDHPublicKey, BCDSAPrivateKey, BCDSAPublicKey, BCECPrivateKey, BCECPublicKey, BCPBEKey, BCRSAPrivateCrtKey, BCRSAPrivateKey, BCRSAPublicKey, DSAPrivateKeyImpl, DSAPublicKeyImpl, JCEDHPrivateKey, JCEDHPublicKey, JCEECPrivateKey, JCEECPublicKey, JCERSAPrivateCrtKey, JCERSAPrivateKey, JCERSAPublicKey, JDKDSAPrivateKey, JDKDSAPublicKey, OpenSSLDSAPrivateKey, OpenSSLDSAPublicKey, OpenSSLECPrivateKey, OpenSSLECPublicKey, OpenSSLRSAPrivateCrtKey, OpenSSLRSAPrivateKey, OpenSSLRSAPublicKey, OpenSSLSecretKey, PrivateKeyImpl, PublicKeyImpl, RepeatedSecretKeySpec, SecretKeySpec, X509PublicKey, X509PublicKey

public interface Key
extends Serializable
Key is the common interface for all keys.
See Also:
PublicKey, PrivateKey
  • Field Summary

    Fields
    Modifier and Type Field Description
    static long serialVersionUID
    The serialVersionUID to be compatible with JDK1.1.
  • Method Summary

    Modifier and Type Method Description
    String getAlgorithm()
    Returns the name of the algorithm of this key.
    byte[] getEncoded()
    Returns the encoded form of this key, or null if encoding is not supported by this key.
    String getFormat()
    Returns the name of the format used to encode this key, or null if it can not be encoded.
  • Field Details

    • serialVersionUID

      static final long serialVersionUID
      The serialVersionUID to be compatible with JDK1.1.
      See Also:
      Constant Field Values
  • Method Details

    • getAlgorithm

      String getAlgorithm()
      Returns the name of the algorithm of this key. If the algorithm is unknown, null is returned.
      Returns:
      the name of the algorithm of this key or null if the algorithm is unknown.
    • getFormat

      String getFormat()
      Returns the name of the format used to encode this key, or null if it can not be encoded.
      Returns:
      the name of the format used to encode this key, or null if it can not be encoded.
    • getEncoded

      byte[] getEncoded()
      Returns the encoded form of this key, or null if encoding is not supported by this key.
      Returns:
      the encoded form of this key, or null if encoding is not supported by this key.