Class SslContextProviders
- java.lang.Object
-
- com.github.fmjsjx.libnetty.handler.ssl.SslContextProviders
-
public class SslContextProviders extends java.lang.ObjectImplementations ofSslContextProvider.- Since:
- 1.1
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SslContextProviderforClient(java.io.File trustCertCollectionFile)Returns a simple implementation ofSslContextProviderwhich holding anSslContexttrusted certificates for verifying the remote endpoint's certificate.static SslContextProviderforServer(java.io.File keyCertChainFile, java.io.File keyFile)static SslContextProviderforServer(java.io.File keyCertChainFile, java.io.File keyFile, java.lang.String keyPassword)static SslContextProviderinsecureForClient()Returns a simple implementation ofSslContextProviderwhich holding an insecureSslContextfor client.static PermutableSslContextProviderpermutable(io.netty.handler.ssl.SslContext sslContext)Returns aPermutableSslContextProviderinstance holding the specifiedSslContext.static SslContextProviderselfSignedForServer()Returns a simple implementation ofSslContextProviderwhich holding a self-signed certificateSslContextfor server.static SslContextProvidersimple(io.netty.handler.ssl.SslContext sslContext)Returns a simple implementation ofSslContextProviderwhich just holding the specifiedSslContext.static SslContextProviderwatchingForClient(java.io.File keyCertChainFile, java.io.File keyFile)Returns anSslContextProviderwhich will auto rebuildSslContextwhen the watching certificate file just be modified.static SslContextProviderwatchingForServer(java.io.File keyCertChainFile, java.io.File keyFile)Returns anSslContextProviderwhich will auto rebuildSslContextwhen the watching certificate file just be modified.
-
-
-
Method Detail
-
selfSignedForServer
public static final SslContextProvider selfSignedForServer() throws SSLRuntimeException
Returns a simple implementation ofSslContextProviderwhich holding a self-signed certificateSslContextfor server.- Returns:
- a
SslContextProviderholding a self-signed certificateSslContextfor server - Throws:
SSLRuntimeException- if any SSL error occurs
-
forServer
public static final SslContextProvider forServer(java.io.File keyCertChainFile, java.io.File keyFile) throws SSLRuntimeException
- Parameters:
keyCertChainFile- an X.509 certificate chain file in PEM formatkeyFile- a PKCS#8 private key file in PEM format- Returns:
- a
SslContextProvider - Throws:
SSLRuntimeException- if any SSL error occurs- See Also:
forServer(File, File, String)
-
forServer
public static final SslContextProvider forServer(java.io.File keyCertChainFile, java.io.File keyFile, java.lang.String keyPassword) throws SSLRuntimeException
- Parameters:
keyCertChainFile- an X.509 certificate chain file in PEM formatkeyFile- a PKCS#8 private key file in PEM formatkeyPassword- the password of thekeyFile, ornullif 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 anSslContextProviderwhich will auto rebuildSslContextwhen the watching certificate file just be modified.- Parameters:
keyCertChainFile- an X.509 certificate chain file in PEM formatkeyFile- a PKCS#8 private key file in PEM format- Returns:
- a
SslContextProvider - Throws:
SSLRuntimeException- if any SSL error occursjava.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 anSslContextProviderwhich will auto rebuildSslContextwhen the watching certificate file just be modified.- Parameters:
keyCertChainFile- an X.509 certificate chain file in PEM formatkeyFile- a PKCS#8 private key file in PEM format- Returns:
- a
SslContextProvider - Throws:
SSLRuntimeException- if any SSL error occursjava.io.IOException- if any IO error occurs
-
insecureForClient
public static final SslContextProvider insecureForClient() throws SSLRuntimeException
Returns a simple implementation ofSslContextProviderwhich holding an insecureSslContextfor client.- Returns:
- a
SslContextProviderholding insecureSslContextfor client - Throws:
SSLRuntimeException- if any SSL error occurs
-
forClient
public static final SslContextProvider forClient(java.io.File trustCertCollectionFile) throws SSLRuntimeException
Returns a simple implementation ofSslContextProviderwhich holding anSslContexttrusted 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 ofSslContextProviderwhich just holding the specifiedSslContext.- Parameters:
sslContext- aSslContext- Returns:
- a
SslContextProvider
-
permutable
public static final PermutableSslContextProvider permutable(io.netty.handler.ssl.SslContext sslContext)
Returns aPermutableSslContextProviderinstance holding the specifiedSslContext.- Parameters:
sslContext- sslContext aSslContext- Returns:
- a
PermutableSslContextProvider - Since:
- 2.0
-
-