Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve NIOSocketSSL class. #7

Closed
GoogleCodeExporter opened this issue Dec 26, 2015 · 3 comments
Closed

Improve NIOSocketSSL class. #7

GoogleCodeExporter opened this issue Dec 26, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

Sometimes you need to use plain socket connection and it's very easy with naga.
But sometimes you need to secure existing plain connection, for example, when 
user makes some actions that needs to be secure.

I try the following:

secureSocket = new SSLSocketChannelResponder(plainSocket, 
sslContext.createSSLEngine(), true);

but it doesn't work.

Original issue reported on code.google.com by abuhar...@gmail.com on 12 Mar 2011 at 7:19

@GoogleCodeExporter
Copy link
Author

The correct way of using it is to use it like the normal NIOSocket classes, 
i.e. create a NIOService then call 
nioService.openSSLSocket(sslContext.createSSLEngine(), url, port). I see how 
that was a bit confusing as the visibility of those classes were incorrectly 
set to public.
I've fixed the visibility of the classes in the latest update.

Original comment by christof...@gmail.com on 12 Mar 2011 at 8:11

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Ok, but how to open plain socket connection use it and then make it secure?

Original comment by abuhar...@gmail.com on 12 Mar 2011 at 8:14

@GoogleCodeExporter
Copy link
Author

Without naga I can do:

------------------------------------------------
private Socket socket;
...
Socket plain = socket;
// Secure the plain connection
socket = context.getSocketFactory().createSocket(plain,
plain.getInetAddress().getHostName(), plain.getPort(), true);
// Initialize the reader and writer with the new secured version
initReaderAndWriter();
// Proceed to do the handshake
 ((SSLSocket) socket).startHandshake();
...
------------------------------------------------

How I can do it with naga?

Original comment by abuhar...@gmail.com on 15 Mar 2011 at 9:04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant