spotify/ssh-agent-tls

Name: ssh-agent-tls

Owner: Spotify

Description: A library that generates X.509 certificates and signs them with SSH agent. For use in client-side TLS handshakes.

Created: 2016-12-06 01:04:35.0

Updated: 2018-05-19 22:58:16.0

Pushed: 2018-05-19 22:58:15.0

Homepage:

Size: 81

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

ssh-agent-tls

Build Status codecov Maven Central License

This Java library provides tools for client-side TLS operations. This project is currently stable and used in Helios.

Download

Download the latest JAR or grab via Maven.

endency>
roupId>com.spotify</groupId>
rtifactId>ssh-agent-tls</artifactId>
ersion>0.0.1</version>
pendency>
Getting started

This example shows how to present a static TLS certificate stored on disk. Specify the paths of the certificate “cert.pem” and private key “key.pem” for CertKeyPaths. Then create an instance of CertFileHttpsHandler, an implementation of HttpsHandler, and use it to handle() the HttpsURLConnection.

l URL url = new URL("https://example.net");
l HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();

l CertKeyPaths certKeyPaths = CertKeyPaths.create(Paths.get("/cert.pem"), Paths.get("/key.pem"));
l CertFileHttpsHandler certFileHttpsHandler =
HttpsHandlers.createCertFileHttpsHandler("username", false, certKeyPaths);
FileHttpsHandler.handle(conn);

This example shows how to use an SSH key pair via ssh-agent (only RSA keys are supported right now) to sign a randomly generated X.509 certificate. Create an instance of SshAgentHttpsHandler, an implementation of HttpsHandler, and use it to handle() the HttpsURLConnection.

rt com.spotify.sshagentproxy.AgentProxies;
rt com.spotify.sshagentproxy.Identity;

l URL url = new URL("https://example.net");
l HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();

l AgentProxy agentProxy = AgentProxies.newInstance();
l List<Identity> identities = agentProxy.list();
l SshAgentHttpsHandler sshAgentHttpsHandler =
HttpsHandlers.createSshAgentHttpsHandler("username", false, agentProxy, identities.get(0));
gentHttpsHandler.handle(conn);
Prerequisities

Any platform that has the following

Code of conduct

This project adheres to the Open Code of Conduct. By participating, you are expected to honor this code.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.