Interface X509Identity

All Superinterfaces:
Destroyable
All Known Implementing Classes:
StaticX509Identity

public interface X509Identity extends Destroyable
Represents a cryptographic identity using a private key and certificate.
  • Method Details

    • getPrivateCredential

      X500PrivateCredential getPrivateCredential()
      Returns the private key and certificate for this identity.
    • getCertificateChain

      X509Certificate[] getCertificateChain()
      Returns the certificate chain for this identity.
    • createSSLContext

      default SSLContext createSSLContext() throws KeyManagementException
      Creates an SSLContext from this identity using the system default TrustManager and SecureRandom.
      Returns:
      a new SSLContext using this identity for authentication
      Throws:
      KeyManagementException - if there is an error initializing the SSLContext
    • createSSLContext

      default SSLContext createSSLContext(X509TrustManager trustManager) throws KeyManagementException
      Creates an SSLContext from this identity using a specific trust manager.
      Parameters:
      trustManager - the trust manager to use for validating TLS peers
      Returns:
      a new SSLContext using this identity for authentication
      Throws:
      KeyManagementException - if there is an error initializing the SSLContext
      See Also:
    • createSSLContext

      default SSLContext createSSLContext(X509TrustManager trustManager, SecureRandom secureRandom) throws KeyManagementException
      Creates an SSLContext from this identity using a specific trust manager and source of randomness.
      Parameters:
      trustManager - the trust manager to use for validating TLS peers
      secureRandom - the source of randomness to use for generating cryptographic bits
      Returns:
      a new SSLContext using this identity for authentication
      Throws:
      KeyManagementException - if there is an error initializing the SSLContext
    • generateAlias

      static String generateAlias(Certificate certificate)
      Generates a certificate alias string. This alias is computed from an extensible output function (XOF) of the certificate's public key.
      Parameters:
      certificate - certificate to compute an alias for
      Returns:
      the computed alias