Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #39270

Re: How to create a ssh/tls connection for a tcp connection in java

From Arne Vajhøj <arne@vajhoej.dk>
Newsgroups comp.lang.java.programmer
Subject Re: How to create a ssh/tls connection for a tcp connection in java
Date 2020-01-03 16:45 -0500
Organization Aioe.org NNTP Server
Message-ID <quoclb$dl$1@gioia.aioe.org> (permalink)
References <7e6fef16-b107-424a-89c2-f717f9a6d595@googlegroups.com>

Show all headers | View raw


On 1/3/2020 8:34 AM, mike wrote:
> I am working on creating a call-home function
> https://tools.ietf.org/html/rfc8071 for java.
> 
> Basically something like this:

> AFAIK the tcp connection in java is done using sockets. But then my
> question is how can convert that into a ssh/tls connection. Is there
> a library that supports wrapping sockets into ssh/tls?

SSLSocket is a sub class pf Socket, so you create a SSLSocket and
use it like a Socket.

There are a few variation ins how to create but maybe
something like:

SSLContext sslctx = SSLContext.getInstance("TLSv1.2");
sslctx.init(null, new X509TrustManager[] { new MyTrustManager() }, null);
SSLSocket s = (SSLSocket) sslctx.getSocketFactory().createSocket(HOST, 
PORT);

Arne

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to create a ssh/tls connection for a tcp connection in java mike <mikaelpetterson@hotmail.com> - 2020-01-03 05:34 -0800
  Re: How to create a ssh/tls connection for a tcp connection in java Arne Vajhøj <arne@vajhoej.dk> - 2020-01-03 16:45 -0500
    Re: How to create a ssh/tls connection for a tcp connection in java mike <mikaelpetterson@hotmail.com> - 2020-01-04 09:53 -0800
      Re: How to create a ssh/tls connection for a tcp connection in java Arne Vajhøj <arne@vajhoej.dk> - 2020-01-04 13:09 -0500
      Re: How to create a ssh/tls connection for a tcp connection in java Martin Gregorie <martin@mydomain.invalid> - 2020-01-04 18:56 +0000

csiph-web