Class CertificateCredential

  • All Implemented Interfaces:
    TokenCredential

    public final class CertificateCredential
    extends Credential
    implements TokenCredential
    Represents a digital certificate used to access certificate secured resources. Supports PKCS#12 cryptography archive bundle files. PKCS#12 is an archive file format for storing multiple cryptography objects. It can contain details about a private key, its certificate, and any associated CA certificates. The archive is usually identified by its .pfx or .p12 file extension. The archive itself or objects it contains may be encrypted and signed.
    Since:
    100.2.0
    • Constructor Summary

      Constructors 
      Constructor Description
      CertificateCredential​(java.lang.String certificatePath, java.lang.String certificatePassword)
      Instantiates a CertificateCredential.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      CertificateCredential copy()
      Creates a copy of this CertificateCredential instance.
      java.lang.String getAlias()
      Gets the alias associated with the certificate.
      java.security.cert.Certificate[] getCertificateChain()
      Gets the certificate chain associated with the credential.
      java.lang.String getPassword()
      Gets the password used to access the certificate file.
      java.lang.String getPath()
      Gets the certificatePath that was passed to the CertificateCredential(String, String) constructor.
      java.security.PrivateKey getPrivateKey()
      Gets the PrivateKey associated with the credential.
      java.lang.String toJson()
      CertificateCredential currently does not support JSON serialization.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CertificateCredential

        public CertificateCredential​(java.lang.String certificatePath,
                                     java.lang.String certificatePassword)
        Instantiates a CertificateCredential.
        Parameters:
        certificatePath - the file path to a PKCS#12 file on disk
        certificatePassword - the password to access and decrypt the provided certificate file
        Throws:
        java.lang.IllegalArgumentException - if the certificatePath is null or empty
        Since:
        100.2.0
    • Method Detail

      • getAlias

        public java.lang.String getAlias()
        Gets the alias associated with the certificate.
        Returns:
        the alias associated with the certificate, null if none has been set
        Since:
        100.2.0
      • getPrivateKey

        public java.security.PrivateKey getPrivateKey()
        Gets the PrivateKey associated with the credential.
        Returns:
        the private key
        Since:
        100.4.0
      • getCertificateChain

        public java.security.cert.Certificate[] getCertificateChain()
        Gets the certificate chain associated with the credential.
        Returns:
        the certificate chain
        Since:
        100.4.0
      • getPath

        public java.lang.String getPath()
        Gets the certificatePath that was passed to the CertificateCredential(String, String) constructor.
        Returns:
        the path to the PKCS#12 file
        Since:
        100.2.0
      • getPassword

        public java.lang.String getPassword()
        Gets the password used to access the certificate file.
        Returns:
        the password
        Since:
        100.2.0
      • copy

        public CertificateCredential copy()
        Creates a copy of this CertificateCredential instance.
        Specified by:
        copy in class Credential
        Returns:
        a copy of this CertificateCredential instance
        Since:
        100.2.0
      • toJson

        public java.lang.String toJson()
        CertificateCredential currently does not support JSON serialization. This method throws an UnsupportedOperationException.
        Overrides:
        toJson in class Credential
        Returns:
        a json String representation of this Credential
        Throws:
        java.lang.UnsupportedOperationException
        Since:
        100.2.0