Example usage for io.netty.handler.ssl SslContext newServerContext

List of usage examples for io.netty.handler.ssl SslContext newServerContext

Introduction

In this page you can find the example usage for io.netty.handler.ssl SslContext newServerContext.

Prototype

@Deprecated
public static SslContext newServerContext(SslProvider provider, File certChainFile, File keyFile,
        String keyPassword) throws SSLException 

Source Link

Document

Creates a new server-side SslContext .

Usage

From source file:com.caricah.iotracah.server.netty.SSLHandler.java

License:Apache License

public SslContext getSslContext() throws UnRetriableException {

    try {/*from   w ww.java  2  s .  co m*/

        File certificateChainFile = getCertificateChainFile();
        File certificateKeyFile = getCertificateKeyFile();
        String keyPassword = getKeyPassword();

        SslProvider sslProvider;
        if (OpenSsl.isAvailable()) {
            sslProvider = SslProvider.OPENSSL;
        } else {
            sslProvider = SslProvider.JDK;
        }

        return SslContext.newServerContext(sslProvider, certificateChainFile, certificateKeyFile, keyPassword);

    } catch (Exception e) {
        log.error(" getSSLEngine : problems when trying to initiate secure protocals", e);
        throw new UnRetriableException(e);
    }
}