Class TrustConfig

java.lang.Object
io.javalin.community.ssl.TrustConfig

public class TrustConfig extends Object
Configuration for the trust store, used to verify the identity of the clients. Using this configuration, the server will only accept connections from clients that are trusted. If no trust store is configured, the server will accept any client.
  • Field Details

    • certificates

      public List<Certificate> certificates
      List of certificates to be trusted, can be loaded using the helper methods or directly. This list is complementary to the keys
    • keyStores

      public List<KeyStore> keyStores
      List of KeyStores to be trusted, can be loaded using the helper methods or directly.
  • Constructor Details

    • TrustConfig

      public TrustConfig()
  • Method Details

    • certificateFromPath

      public void certificateFromPath(String certificatePath)
      Load certificate data from a given path in the system. The certificate can be in PEM, P7B/PKCS#7 or DER format.
      Parameters:
      certificatePath - path to the certificate file.
    • certificateFromClasspath

      public void certificateFromClasspath(String certificateFile)
      Load certificate data from the classpath. The certificate can be in PEM, P7B/PKCS#7 or DER format.
      Parameters:
      certificateFile - The name of the certificate file in the classpath.
    • certificateFromInputStream

      public void certificateFromInputStream(InputStream certificateInputStream)
      Load certificate data from a given input stream. The certificate can be in PEM, P7B/PKCS#7 or DER format.
      Parameters:
      certificateInputStream - input stream to the certificate file.
    • p7bCertificateFromString

      public void p7bCertificateFromString(String certificateString)
      Load P7B certificate data from a given string. The certificate must be in P7B/PKCS#7 format.
      Parameters:
      certificateString - P7B encoded certificate.
    • pemFromString

      public void pemFromString(String certificateString)
      Load pem formatted identity data from a given string. The certificate must be in PEM format.
      Parameters:
      certificateString - PEM encoded certificate.
    • trustStoreFromPath

      public void trustStoreFromPath(String trustStorePath, String trustStorePassword)
      Load a trust store from a given path in the system. The trust store can be in JKS or PKCS12 format.
      Parameters:
      trustStorePath - path to the trust store file.
      trustStorePassword - password for the trust store.
    • trustStoreFromInputStream

      public void trustStoreFromInputStream(InputStream trustStoreInputStream, String trustStorePassword)
      Load a trust store from a given input stream. The trust store can be in JKS or PKCS12 format.
      Parameters:
      trustStoreInputStream - input stream to the trust store file.
      trustStorePassword - password for the trust store.
    • trustStoreFromClasspath

      public void trustStoreFromClasspath(String trustStoreFile, String trustStorePassword)
      Load a trust store from the classpath.
      Parameters:
      trustStoreFile - The name of the trust store file in the classpath.
      trustStorePassword - password for the trust store.