Code Monkey home page Code Monkey logo

ssh-agent-tls's Introduction

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.

<dependency>
  <groupId>com.spotify</groupId>
  <artifactId>ssh-agent-tls</artifactId>
  <version>0.0.1</version>
</dependency>

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.

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

final CertKeyPaths certKeyPaths = CertKeyPaths.create(Paths.get("/cert.pem"), Paths.get("/key.pem"));
final CertFileHttpsHandler certFileHttpsHandler =
    HttpsHandlers.createCertFileHttpsHandler("username", false, certKeyPaths);
certFileHttpsHandler.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.

import com.spotify.sshagentproxy.AgentProxies;
import com.spotify.sshagentproxy.Identity;

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

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

Prerequisities

Any platform that has the following

  • Java 7+
  • Maven 3 (for compiling)

Code of conduct

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

ssh-agent-tls's People

Contributors

davidxia avatar mattnworb avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.