Record Class PemSslStoreDetails

java.lang.Object
java.lang.Record
org.springframework.boot.ssl.pem.PemSslStoreDetails
Record Components:
type - the key store type, for example JKS or PKCS11. A null value will use KeyStore.getDefaultType()).
alias - the alias used when setting entries in the KeyStore
password - the password used setting key entries in the KeyStore
certificates - the certificates content (either the PEM content itself or or a reference to the resource to load). When a private key is present this value is treated as a certificate chain, otherwise it is treated a list of certificates that should all be registered.
privateKey - the private key content (either the PEM content itself or a reference to the resource to load)
privateKeyPassword - a password used to decrypt an encrypted private key

public record PemSslStoreDetails(String type, String alias, String password, String certificates, String privateKey, String privateKeyPassword) extends Record
Details for an individual trust or key store in a PemSslStoreBundle.
Since:
3.1.0
Author:
Scott Frederick, Phillip Webb
See Also:
  • Constructor Details

    • PemSslStoreDetails

      public PemSslStoreDetails(String type, String alias, String password, String certificates, String privateKey, String privateKeyPassword)
      Create a new PemSslStoreDetails instance.
      Parameters:
      type - the key store type, for example JKS or PKCS11. A null value will use KeyStore.getDefaultType()).
      alias - the alias used when setting entries in the KeyStore
      password - the password used setting key entries in the KeyStore
      certificates - the certificate content (either the PEM content itself or a reference to the resource to load)
      privateKey - the private key content (either the PEM content itself or a reference to the resource to load)
      privateKeyPassword - a password used to decrypt an encrypted private key
      Since:
      3.2.0
    • PemSslStoreDetails

      public PemSslStoreDetails(String type, String certificate, String privateKey, String privateKeyPassword)
      Create a new PemSslStoreDetails instance.
      Parameters:
      type - the key store type, for example JKS or PKCS11. A null value will use KeyStore.getDefaultType()).
      certificate - the certificate content (either the PEM content itself or a reference to the resource to load)
      privateKey - the private key content (either the PEM content itself or a reference to the resource to load)
      privateKeyPassword - a password used to decrypt an encrypted private key
    • PemSslStoreDetails

      public PemSslStoreDetails(String type, String certificate, String privateKey)
      Create a new PemSslStoreDetails instance.
      Parameters:
      type - the key store type, for example JKS or PKCS11. A null value will use KeyStore.getDefaultType()).
      certificate - the certificate content (either the PEM content itself or a reference to the resource to load)
      privateKey - the private key content (either the PEM content itself or a reference to the resource to load)
  • Method Details

    • certificate

      @Deprecated(since="3.2.0", forRemoval=true) public String certificate()
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 3.2.0 for removal in 3.4.0 in favor of certificates()
      Return the certificate content.
      Returns:
      the certificate content
    • withAlias

      public PemSslStoreDetails withAlias(String alias)
      Return a new PemSslStoreDetails instance with a new alias.
      Parameters:
      alias - the new alias
      Returns:
      a new PemSslStoreDetails instance
      Since:
      3.2.0
    • withPassword

      public PemSslStoreDetails withPassword(String password)
      Return a new PemSslStoreDetails instance with a new password.
      Parameters:
      password - the new password
      Returns:
      a new PemSslStoreDetails instance
      Since:
      3.2.0
    • withPrivateKey

      public PemSslStoreDetails withPrivateKey(String privateKey)
      Return a new PemSslStoreDetails instance with a new private key.
      Parameters:
      privateKey - the new private key
      Returns:
      a new PemSslStoreDetails instance
    • withPrivateKeyPassword

      public PemSslStoreDetails withPrivateKeyPassword(String privateKeyPassword)
      Return a new PemSslStoreDetails instance with a new private key password.
      Parameters:
      privateKeyPassword - the new private key password
      Returns:
      a new PemSslStoreDetails instance
    • forCertificate

      public static PemSslStoreDetails forCertificate(String certificate)
      Factory method to create a new PemSslStoreDetails instance for the given certificate. Note: This method doesn't actually check if the provided value only contains a single certificate. It is functionally equivalent to forCertificates(String).
      Parameters:
      certificate - the certificate content (either the PEM content itself or a reference to the resource to load)
      Returns:
      a new PemSslStoreDetails instance.
    • forCertificates

      public static PemSslStoreDetails forCertificates(String certificates)
      Factory method to create a new PemSslStoreDetails instance for the given certificates.
      Parameters:
      certificates - the certificates content (either the PEM content itself or a reference to the resource to load)
      Returns:
      a new PemSslStoreDetails instance.
      Since:
      3.2.0
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • type

      public String type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • alias

      public String alias()
      Returns the value of the alias record component.
      Returns:
      the value of the alias record component
    • password

      public String password()
      Returns the value of the password record component.
      Returns:
      the value of the password record component
    • certificates

      public String certificates()
      Returns the value of the certificates record component.
      Returns:
      the value of the certificates record component
    • privateKey

      public String privateKey()
      Returns the value of the privateKey record component.
      Returns:
      the value of the privateKey record component
    • privateKeyPassword

      public String privateKeyPassword()
      Returns the value of the privateKeyPassword record component.
      Returns:
      the value of the privateKeyPassword record component