diff --git a/handler/src/main/java/io/netty/handler/ssl/SslContext.java b/handler/src/main/java/io/netty/handler/ssl/SslContext.java index 05f55274ef..2a61e66fad 100644 --- a/handler/src/main/java/io/netty/handler/ssl/SslContext.java +++ b/handler/src/main/java/io/netty/handler/ssl/SslContext.java @@ -76,7 +76,7 @@ import java.util.List; *
* // In your {@link ChannelInitializer}: * {@link ChannelPipeline} p = channel.pipeline(); - * {@link SslContext} sslCtx = {@link #newBuilderForClient() SslContext.newBuilderForClient()}.build(); + * {@link SslContext} sslCtx = {@link SslContextBuilder#forClient() SslContextBuilder.forClient()}.build(); * p.addLast("ssl", {@link #newEngine(ByteBufAllocator, String, int) sslCtx.newEngine(channel.alloc(), host, port)}); * ... *diff --git a/handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java b/handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java index fcc840e6ca..a0d3caf45d 100644 --- a/handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java +++ b/handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java @@ -39,6 +39,7 @@ public final class SslContextBuilder { * * @param keyCertChainFile an X.509 certificate chain file in PEM format * @param keyFile a PKCS#8 private key file in PEM format + * @see #keyManager(File, File) */ public static SslContextBuilder forServer(File keyCertChainFile, File keyFile) { return new SslContextBuilder(true).keyManager(keyCertChainFile, keyFile); @@ -51,12 +52,23 @@ public final class SslContextBuilder { * @param keyFile a PKCS#8 private key file in PEM format * @param keyPassword the password of the {@code keyFile}, or {@code null} if it's not * password-protected + * @see #keyManager(File, File, String) */ public static SslContextBuilder forServer( File keyCertChainFile, File keyFile, String keyPassword) { return new SslContextBuilder(true).keyManager(keyCertChainFile, keyFile, keyPassword); } + /** + * Creates a builder for new server-side {@link SslContext}. + * + * @param keyManagerFactory non-{@code null} factory for server's private key + * @see #keyManager(KeyManagerFactory) + */ + public static SslContextBuilder forServer(KeyManagerFactory keyManagerFactory) { + return new SslContextBuilder(true).keyManager(keyManagerFactory); + } + private final boolean forServer; private SslProvider provider; private File trustCertChainFile;