Class PEMContextBuilderImpl

java.lang.Object
io.github.stevenjdh.simple.ssl.PEMContextBuilderImpl
All Implemented Interfaces:
PEMContext.Builder

class PEMContextBuilderImpl extends Object implements PEMContext.Builder
  • Field Details

    • publicKeyPath

      Path publicKeyPath
    • privateKeyPath

      Path privateKeyPath
    • privateKeyPassword

      char[] privateKeyPassword
    • privateKeyCertChainPath

      Path privateKeyCertChainPath
    • keyStorePath

      Path keyStorePath
    • keyStorePassword

      char[] keyStorePassword
    • trustStorePath

      Path trustStorePath
    • trustStorePassword

      char[] trustStorePassword
    • keyStoreType

    • trustStoreType

  • Constructor Details

    • PEMContextBuilderImpl

      PEMContextBuilderImpl()
  • Method Details

    • withPublicKey

      public PEMContext.Builder withPublicKey(Path certPath)
      Description copied from interface: PEMContext.Builder
      Optionally sets the truststore configuration using a Base64 encoded certificate or certificate chain for building an SSLContext.
      Specified by:
      withPublicKey in interface PEMContext.Builder
      Parameters:
      certPath - The path to the file containing one or more certificates.
      Returns:
      This builder.
    • withPrivateKey

      public PEMContext.Builder withPrivateKey(Path keyPath, Path certPath)
      Description copied from interface: PEMContext.Builder
      Optionally sets the keystore configuration using a Base64 encoded private key for building an SSLContext.
      Specified by:
      withPrivateKey in interface PEMContext.Builder
      Parameters:
      keyPath - The path to the file containing the private key material.
      certPath - The path to the file containing the certificate or certificate chain with the corresponding public key that pairs with the private key.
      Returns:
      This builder.
    • withPrivateKeyPassword

      public PEMContext.Builder withPrivateKeyPassword(char[] password)
      Description copied from interface: PEMContext.Builder
      Optionally sets the password for the encrypted private key material.
      Specified by:
      withPrivateKeyPassword in interface PEMContext.Builder
      Parameters:
      password - The password used to decrypt the encrypted key. If this is set to null or an empty char[], it will be assumed that decryption is not needed.
      Returns:
      This builder.
    • saveKeyStore

      public PEMContext.Builder saveKeyStore(Path keyMaterialPath, char[] password)
      Description copied from interface: PEMContext.Builder
      Optionally saves the built keystore to the provided path, and protects its integrity with a password.
      Specified by:
      saveKeyStore in interface PEMContext.Builder
      Parameters:
      keyMaterialPath - The path used for saving the keystore.
      password - The password to set when saving the keystore, which has a minimum length of 4 characters.
      Returns:
      This builder.
    • saveTrustStore

      public PEMContext.Builder saveTrustStore(Path trustMaterialPath, char[] password)
      Description copied from interface: PEMContext.Builder
      Optionally saves the built truststore to the provided path, and protects its integrity with a password.
      Specified by:
      saveTrustStore in interface PEMContext.Builder
      Parameters:
      trustMaterialPath - The path used for saving the truststore.
      password - The password to set when saving the truststore, which has a minimum length of 4 characters.
      Returns:
      This builder.
    • keyStoreType

      Description copied from interface: PEMContext.Builder
      Optionally sets the keystore type being built with PKCS12 being the default.
      Specified by:
      keyStoreType in interface PEMContext.Builder
      Parameters:
      type - The keystore type such as PKCS12 or the legacy JKS.
      Returns:
      This builder.
    • trustStoreType

      public PEMContext.Builder trustStoreType(SimpleSSLContext.KeyStoreType type)
      Description copied from interface: PEMContext.Builder
      Optionally sets the truststore type being built with PKCS12 being the default.
      Specified by:
      trustStoreType in interface PEMContext.Builder
      Parameters:
      type - The truststore type such as PKCS12 or the legacy JKS.
      Returns:
      This builder.
    • build

      public SSLContext build()
      Description copied from interface: PEMContext.Builder
      Returns a new SSLContext instance built from the current state of this builder.
      Specified by:
      build in interface PEMContext.Builder
      Returns:
      A new SSLContext.