I found an example how to implement Java SSLEngine here. Unfortunately the source code of the server is not complete. Do you know where I can find the complete source code from the tutorial?
Searching for an SSLEngine implementation myself, I started writing my own one, which I shared on Github. It involves an SSL/TLS server and client, and also a Demo class containing a running example. I would be glad if you take a look and even more if you provide feedback about possible bugs or better implementation.
Also feel free to check a post I uploaded on my (really newly created!) blog, where I collected various information about SSL/TLS. :)
A similar but more complete example for SSLEngine implementation can be found here.
I came across the same problem some years ago and ended up writing my own library. There are some examples out there and of course there is also the code inside projects like Netty, etc. But neither option is robust or easily reusable.
TLS Channel wraps an SSLEngine in a ByteBuffer and allows to use it just like normal SocketChannels.
webpieces uses a jar ( https://mvnrepository.com/artifact/org.webpieces/core-ssl ) that wraps the SSLEngine and makes using it in any context much easier.
Of course the project/subproject is here https://github.com/deanhiller/webpieces/tree/master/core/core-ssl
or you can just start up the whole webpieces server. (It's called webpieces because every part is a piece including that ssl piece, an async http1.1 parser, http2 parser, etc....all pieces you can steal and use). It just happens all pieces are also used to create a webserver.
later, Dean
来源:https://stackoverflow.com/questions/13722317/java-sslengine-example