Class TLSContext


  • public class TLSContext
    extends Object

    An instance of TLSContext prepares a TLSProtocol context for encrypted HTTPS connections.

    Information: TLS is the follow up protocol of the (better known) SSL (Secure Socket Layer) protocol - SSL is no longer supported by the webPDF wsclient, as it is obsolete and insecure.

    Be aware: An implementation of TLSContext is not required to serve multiple Sessions at a time. It is expected to create a new TLSContext for each existing Session (That shall use HTTPS).

    • Constructor Detail

      • TLSContext

        public TLSContext​(@NotNull
                          @NotNull TLSProtocol tlsProtocol,
                          boolean allowSelfSigned,
                          @NotNull
                          @NotNull File trustStore,
                          @Nullable
                          @Nullable String trustStorePassword)

        Prepares a fresh the TLSContext for an HTTPS connection.

        Sets the X509Certificate truststore file and it´s password. The truststore shall determine which connection targets shall be deemed trustworthy.

        Parameters:
        trustStore - Selects the X509Certificate truststore file
        trustStorePassword - Selects a possibly necessary password for the truststore file.
        allowSelfSigned - Set to true to allow the usage of self-signed X509Certificates.
        tlsProtocol - The TLSProtocol, that shall be used.
      • TLSContext

        public TLSContext​(@NotNull
                          @NotNull TLSProtocol tlsProtocol,
                          boolean allowSelfSigned)
        Prepares a fresh the TLSContext for an HTTPS connection.
        Parameters:
        tlsProtocol - The TLSProtocol, that shall be used.
        allowSelfSigned - Set to true to allow the usage of self-signed X509Certificates.
      • TLSContext

        public TLSContext()
        Prepares a fresh the TLSContext for an HTTPS connection.
        This empty default constructor defaults to TLSProtocol.TLSV1_3, does not allow self-signed X509Certificates and will not configure a truststore.
    • Method Detail

      • isAllowSelfSigned

        public boolean isAllowSelfSigned()
        Returns true, if self-signed X509Certificates shall be accepted.
        Returns:
        true, if self-signed X509Certificates shall be accepted.
      • getTrustStore

        @Nullable
        public @Nullable File getTrustStore()
        Returns the selected X509Certificate truststore file
        Returns:
        the selected X509Certificate truststore file
      • getTrustStorePassword

        @Nullable
        public @Nullable String getTrustStorePassword()
        Returns the password for the selected X509Certificate truststore file
        Returns:
        The password for the selected X509Certificate truststore file
      • create

        @NotNull
        public @NotNull SSLContext create()
                                   throws ResultException

        Returns (and/or initializes) the Session´s SSLContext.

        Information: Actually this is not exactly a "SSL" context, but a "TLS" context. TLS is the follow up protocol of the (better known) SSL (Secure Socket Layer) protocol - SSL is no longer supported by the webPDF wsclient, as it is obsolete and insecure.

        Returns:
        The resulting SSLContext.
        Throws:
        ResultException