12998

Netty 4 : Configure client certificates in SslContextBuilder

Question:

I have a p12 format client ssl certificates.

How can I configure it in Netty in <a href="https://netty.io/4.1/api/io/netty/handler/ssl/SslContextBuilder.html" rel="nofollow">SslContextBuilder</a> class?

Answer1:

Convert the <a href="https://stackoverflow.com/a/8224863/678116" rel="nofollow">.p12 to a Java Keystore.</a>

When starting your application, make sure you set the following system properties with the path to your Java Keystore (.jks) and given password:

<ul><li>javax.net.ssl.keyStore</li> <li>javax.net.ssl.keyStorePassword</li> </ul>

Then, you can create a default SSLContext as shown below and add it to Netty's pipeline:

SSLContext ctx = SSLContext.getDefault(); SSLEngine engine = ctx.createSSLEngine(); engine.setUseClientMode(true); pipeline.addLast("sslHandler", new SslHandler(engine));

Recommend

  • wildfly-maven-plugin deployment over SSL works once then “connection error”
  • How to access certificates and private key from etoken using java
  • What format is java's cacerts format expected to be?
  • Get key hash for release
  • Firebase Authentication is failing with “Developer Error” after uploading apk to google play store
  • Cannot Delete an alias from the KeyStore
  • imported a certificate.pfx into cacerts and still getting “PKIX…unable to find valid certification p
  • Android signing problem
  • c++ search a vector for element first seen position
  • Is there any purpose for h2-h6 headings in HTML5?
  • gspread or such: help me get cell coordinates (not value)
  • How do I exclude a dependency in provided scope when running in Maven test scope?
  • iOS: Detect app start via notification press
  • MongoError: Incorrect arguments
  • Django rest serializer Breaks when data exists
  • Q promise. Difference between .when and .then
  • formatting the colorbar ticklabels with SymLogNorm normalization in matplotlib
  • C# - Serializing and deserializing static member
  • Cross-Platform Protobuf Serialization
  • script to move all files from one location to another location
  • Sending data from AppleScript to FileMaker records
  • ILMerge & Keep Assembly Name
  • Symfony2: How to get request parameter
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • How to format a variable of double type
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • How to include full .NET prerequisite for Wix Burn installer
  • Proper folder structure for lots of source files
  • C# - Getting references of reference
  • How to set the response of a form post action to a iframe source?
  • coudnt use logback because of log4j
  • Change div Background jquery
  • How does Linux kernel interrupt the application?
  • Qt: Run a script BEFORE make
  • Authorize attributes not working in MVC 4
  • Is it possible to post an object from jquery to bottle.py?
  • JaxB to read class hierarchy
  • reshape alternating columns in less time and using less memory
  • UserPrincipal.Current returns apppool on IIS