I\'m stuck at the creation of an SSLContext (which I want to use to instantiate an SSLEngine to handle encrypted transport via the java-nio):
The code
Bouncy Castle actually provides a JSSE implementation as of version 1.56. Just make sure to configure it with a higher priority at the application startup:
Security.insertProviderAt(new BouncyCastleJsseProvider(), 1);
or, as alternative, in global file:
security.provider.1=org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
...
security.provider.6=com.sun.net.ssl.internal.ssl.Provider
You can use it then with the standard API:
SSLContext context = SSLContext.getInstance("TLS");