Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #39268 > unrolled thread
| Started by | mike <mikaelpetterson@hotmail.com> |
|---|---|
| First post | 2020-01-03 05:34 -0800 |
| Last post | 2020-01-04 18:56 +0000 |
| Articles | 5 — 3 participants |
Back to article view | Back to comp.lang.java.programmer
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
| From | mike <mikaelpetterson@hotmail.com> |
|---|---|
| Date | 2020-01-03 05:34 -0800 |
| Subject | How to create a ssh/tls connection for a tcp connection in java |
| Message-ID | <7e6fef16-b107-424a-89c2-f717f9a6d595@googlegroups.com> |
Hi,
I am working on creating a call-home function https://tools.ietf.org/html/rfc8071
for java.
Basically something like this:
NETCONF/RESTCONF NETCONF/RESTCONF
Server Client
| |
| 1. TCP |
|----------------------------------->|
| |
| |
| 2. SSH/TLS |
|<-----------------------------------|
| |
| |
| 3. NETCONF/RESTCONF |
|<-----------------------------------|
| |
Note: Arrows point from the "client" to
the "server" at each protocol layer.
Figure 1: Call Home Sequence Diagram
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?
br
//mike
[toc] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2020-01-03 16:45 -0500 |
| Message-ID | <quoclb$dl$1@gioia.aioe.org> |
| In reply to | #39268 |
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
[toc] | [prev] | [next] | [standalone]
| From | mike <mikaelpetterson@hotmail.com> |
|---|---|
| Date | 2020-01-04 09:53 -0800 |
| Message-ID | <dedbd9df-64a7-476e-acba-68f55ac70470@googlegroups.com> |
| In reply to | #39270 |
Hi, Thanks for reply Arne. Is there something similar for ssh? ( need to support that too). Br, Mike
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2020-01-04 13:09 -0500 |
| Message-ID | <quqkbv$1s25$1@gioia.aioe.org> |
| In reply to | #39272 |
On 1/4/2020 12:53 PM, mike wrote: > Is there something similar for ssh? ( need to support that too). I don't think there is anything builtin. There are third party libraries. I have heard about people using this library: http://www.jcraft.com/jsch/ https://sourceforge.net/projects/jsch/files/jsch.jar/ Never used it myself. Arne
[toc] | [prev] | [next] | [standalone]
| From | Martin Gregorie <martin@mydomain.invalid> |
|---|---|
| Date | 2020-01-04 18:56 +0000 |
| Message-ID | <quqn49$njv$1@dont-email.me> |
| In reply to | #39272 |
On Sat, 04 Jan 2020 09:53:34 -0800, mike wrote: > Hi, > Thanks for reply Arne. Is there something similar for ssh? ( need to > support that too). > Is your Java program expecting to connect to an sshd server, i.e. to make connections as though it is ssh? If so, you might want to look at JavaTelnet, an applet that claims to act as both a telnet and an ssh client program. http://javatelnet.org/ You may also find the SourceForge OpenSSH-Java Library useful: http://quietcoffee.sourceforge.net/ From the wabsite: Description =========== This is an attempt at a comprehensive, open source implementation of OpenSSH for the Java platform. It includes both the SSH1 and SSH2 protocols, and supports a number of different cryptographic algorithms, based on the Sun JCE Java extensions. Justification ============= Few free Java SSH implementations. Those that do exist are under GPL, and often slow. Want a OpenBSD-license implementation to be compatible with the Apache project. In particular would like to implement a fast SSH and SCP task for Jakarta Ant. Implementation ============== The implementation at this point is simply being built from OpenSSH-3.1p1 sources from the Cygwin distribution. The goal here is to keep as close as possible to the original implementation so that changes and bugfixes in that codebase can easily be ported to the Java implementation. At the same time, small amounts of refactoring is done to give it a cleaner OO structure and to avoid reimplementing classes already available for Java (ie by using java.math.BigInteger, java.security.* and the javax.crypto.* packages to eliminate the OpenSSL dependencies). Its quite old, Java 1.4, but should still be useful as a basis for your code. -- Martin | martin at Gregorie | gregorie dot org
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web