Class SslContextProviders


  • public class SslContextProviders
    extends java.lang.Object
    Implementations of SslContextProvider.
    Since:
    1.1
    • Method Detail

      • forServer

        public static final SslContextProvider forServer​(java.io.File keyCertChainFile,
                                                         java.io.File keyFile,
                                                         java.lang.String keyPassword)
                                                  throws SSLRuntimeException
        Returns a simple implementation of SslContextProvider which holding a server-side SslContext.
        Parameters:
        keyCertChainFile - an X.509 certificate chain file in PEM format
        keyFile - a PKCS#8 private key file in PEM format
        keyPassword - the password of the keyFile, or null if it's not password-protected
        Returns:
        a SslContextProvider
        Throws:
        SSLRuntimeException - if any SSL error occurs
        See Also:
        forServer(File, File)
      • watchingForServer

        public static final SslContextProvider watchingForServer​(java.io.File keyCertChainFile,
                                                                 java.io.File keyFile)
                                                          throws SSLRuntimeException,
                                                                 java.io.IOException
        Returns an SslContextProvider which will auto rebuild SslContext when the watching certificate file just be modified.
        Parameters:
        keyCertChainFile - an X.509 certificate chain file in PEM format
        keyFile - a PKCS#8 private key file in PEM format
        Returns:
        a SslContextProvider
        Throws:
        SSLRuntimeException - if any SSL error occurs
        java.io.IOException - if any IO error occurs
      • watchingForClient

        public static final SslContextProvider watchingForClient​(java.io.File keyCertChainFile,
                                                                 java.io.File keyFile)
                                                          throws SSLRuntimeException,
                                                                 java.io.IOException
        Returns an SslContextProvider which will auto rebuild SslContext when the watching certificate file just be modified.
        Parameters:
        keyCertChainFile - an X.509 certificate chain file in PEM format
        keyFile - a PKCS#8 private key file in PEM format
        Returns:
        a SslContextProvider
        Throws:
        SSLRuntimeException - if any SSL error occurs
        java.io.IOException - if any IO error occurs
      • forClient

        public static final SslContextProvider forClient​(java.io.File trustCertCollectionFile)
                                                  throws SSLRuntimeException
        Returns a simple implementation of SslContextProvider which holding an SslContext trusted certificates for verifying the remote endpoint's certificate.

        The file should contain an X.509 certificate collection in PEM format.

        Parameters:
        trustCertCollectionFile - file contains an X.509 certificate collection in PEM format
        Returns:
        a SslContextProvider
        Throws:
        SSLRuntimeException - if any SSL error occurs
      • simple

        public static final SslContextProvider simple​(io.netty.handler.ssl.SslContext sslContext)
        Returns a simple implementation of SslContextProvider which just holding the specified SslContext.
        Parameters:
        sslContext - a SslContext
        Returns:
        a SslContextProvider
      • permutable

        public static final PermutableSslContextProvider permutable​(io.netty.handler.ssl.SslContext sslContext)
        Returns a PermutableSslContextProvider instance holding the specified SslContext.
        Parameters:
        sslContext - sslContext a SslContext
        Returns:
        a PermutableSslContextProvider
        Since:
        2.0