Skip to content

Commit

Permalink
1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Mico Papp committed Jul 17, 2022
1 parent f699a1b commit 36f73a6
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 17 deletions.
45 changes: 28 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,27 @@

# java-ssl-tools (jssl)

Install certificate into java keystore and check SSL handshake easily, like
A keytool alternative with handshake checking mechanism.
Install certificate and check the result like:

![demo](jssl.gif)


```
$ jssl example.com install
Certificate was added to keystore
```
```
$ jssl example.com ping
Successfully connected to Socket[addr=example.com/93.184.216.34,port=443,localport=64233]
```

No more PKIX error! :)

## How to install

Just run:
```
curl -sL https://raw.githubusercontent.com/pmamico/java-ssl-tools/main/install.sh | bash
```
for windows, use `Git Bash` or bash enabled powershell as system administrator.
on Windows, use `Git Bash` or bash enabled `Powershell` as system administrator.


### Requirements

* `JAVA_HOME` environment
* `openssl`

## Manual
```
Expand All @@ -42,9 +41,21 @@ Usage: jssl <host> <operation> [-p|--port <arg>] [-a|--alias <arg>] [-h|--help]
-v, --version: Prints version
```

## Requirements

* `JAVA_HOME` environment
* `openssl`


## Why not just use `keytool`?
Java has a built-in `keytool` to handle certificates on the java keystore.
However it has a few drawbacks:
### In `keytool` there is no way to check that the certifiacate works
With `jssl` just type
```
$ jssl <URL> ping
```
### With `keytool` you have to write a lot!
first you need to get the certificate somehow, then to import it with keytool, thinking about alias names and the default password. Eg.:
```
$ echo | openssl s_client -connect "<URL>:443" 2>/dev/null | openssl x509 > certificate.pem
$ /opt/homebrew/opt/openjdk@11/bin/keytool -importcert -cacerts -noprompt -alias <myalias> -file certificate.pem -keypass changeit -storepass changeit
```
is equivalent to
```
$ jssl <URL> install
```
81 changes: 81 additions & 0 deletions ascii.cast
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{"version": 2, "width": 200, "height": 40, "timestamp": 1658076548, "env": {"SHELL": "/usr/local/bin/fish", "TERM": "xterm-256color"}}
[0.086634, "o", "Welcome to fish, the friendly interactive shell\r\nType \u001b[32mhelp\u001b(B\u001b[m for instructions on how to use fish\r\n"]
[0.089136, "o", "\u001b[?2004h"]
[0.105587, "o", "\u001b]0;~/r/p/java-ssl-tools\u0007\u001b[30m\u001b(B\u001b[m\r"]
[0.105616, "o", "\u001b[J\u001b[K\r\n\u001b[1;36mjava-ssl-tools\u001b[0m on \u001b[1;35m main\u001b[0m \u001b[K\r\n\u001b[1;32m❯\u001b[0m \u001b[K\r\u001b[C\u001b[C"]
[2.290178, "o", "j\r\u001b[3C"]
[2.290599, "o", "\b\u001b[91mj\r\u001b[3C\u001b[30m\u001b(B\u001b[m"]
[2.291518, "o", "\u001b[30mssl example.com uninstall\r\u001b[3C\u001b[30m\u001b(B\u001b[m"]
[2.425202, "o", "\u001b[91ms\u001b[30msl example.com uninstall\r\u001b[4C\u001b[30m\u001b(B\u001b[m"]
[2.575544, "o", "\u001b[91ms\u001b[30ml example.com uninstall\r\u001b[5C\u001b[30m\u001b(B\u001b[m"]
[2.650765, "o", "\u001b[91ml\u001b[30m example.com uninstall\r\u001b[6C\u001b[30m\u001b(B\u001b[m"]
[2.65115, "o", "\b\b\b\b\u001b[34mjssl\u001b[30m example.com uninstall\r\u001b[6C\u001b[30m\u001b(B\u001b[m"]
[3.131453, "o", "\u001b[34m \u001b[30mexample.com uninstall\r\u001b[7C\u001b[30m\u001b(B\u001b[m"]
[3.131743, "o", "\b \u001b[30mexample.com uninstall\r\u001b[7C\u001b[30m\u001b(B\u001b[m"]
[3.308658, "o", "e\u001b[30mxample.com uninstall\r\u001b[8C\u001b[30m\u001b(B\u001b[m"]
[3.309134, "o", "\b\u001b[36me\u001b[30mxample.com uninstall\r\u001b[8C\u001b[30m\u001b(B\u001b[m"]
[3.611378, "o", "\u001b[36mx\u001b[30mample.com uninstall\r\u001b[9C\u001b[30m\u001b(B\u001b[m"]
[3.775863, "o", "\u001b[36ma\u001b[30mmple.com uninstall\r\u001b[10C\u001b[30m\u001b(B\u001b[m"]
[3.896233, "o", "\u001b[36mm\u001b[30mple.com uninstall\r\u001b[11C\u001b[30m\u001b(B\u001b[m"]
[4.046403, "o", "\u001b[36mp\u001b[30mle.com uninstall\r\u001b[12C\u001b[30m\u001b(B\u001b[m"]
[4.121674, "o", "\u001b[36ml\u001b[30me.com uninstall\r\u001b[13C\u001b[30m\u001b(B\u001b[m"]
[4.211534, "o", "\u001b[36me\u001b[30m.com uninstall\r\u001b[14C\u001b[30m\u001b(B\u001b[m"]
[4.36099, "o", "\u001b[36m.\u001b[30mcom uninstall\r\u001b[15C\u001b[30m\u001b(B\u001b[m"]
[4.661902, "o", "\u001b[36mc\u001b[30mom uninstall\r\u001b[16C\u001b[30m\u001b(B\u001b[m"]
[4.750838, "o", "\u001b[36mo\u001b[30mm uninstall\r\u001b[17C\u001b[30m\u001b(B\u001b[m"]
[4.810771, "o", "\u001b[36mm\u001b[30m uninstall\r\u001b[18C\u001b[30m\u001b(B\u001b[m"]
[4.961584, "o", "\u001b[36m \u001b[30muninstall\r\u001b[19C\u001b[30m\u001b(B\u001b[m"]
[4.961936, "o", "\b \u001b[30muninstall\r\u001b[19C\u001b[30m\u001b(B\u001b[m"]
[5.171045, "o", "i\u001b[K\r\u001b[20C"]
[5.171354, "o", "\u001b[30mnstall\r\u001b[20C\u001b[30m\u001b(B\u001b[m"]
[5.171488, "o", "\b\u001b[36m\u001b[4mi\u001b[30m\u001b[24mnstall\r\u001b[20C\u001b[30m\u001b(B\u001b[m"]
[5.214818, "o", "\u001b[36m\u001b[4mn\u001b[30m\u001b[24mstall\r\u001b[21C\u001b[30m\u001b(B\u001b[m"]
[5.259679, "o", "\u001b[36m\u001b[4ms\u001b[30m\u001b[24mtall\r\u001b[22C\u001b[30m\u001b(B\u001b[m"]
[5.319561, "o", "\u001b[36m\u001b[4mt\u001b[30m\u001b[24mall\r\u001b[23C\u001b[30m\u001b(B\u001b[m"]
[5.41276, "o", "\u001b[36m\u001b[4ma\u001b[30m\u001b[24mll\r\u001b[24C\u001b[30m\u001b(B\u001b[m"]
[5.513691, "o", "\u001b[36m\u001b[4ml\u001b[30m\u001b[24ml\r\u001b[25C\u001b[30m\u001b(B\u001b[m"]
[5.649988, "o", "\u001b[36m\u001b[4ml\r\u001b[26C\u001b[30m\u001b(B\u001b[m"]
[6.025773, "o", "\r\u001b[26C\r\n\u001b[30m\u001b(B\u001b[m"]
[6.050449, "o", "\u001b[?2004l"]
[6.051185, "o", "\u001b]0;jssl example.com ins ~/r/p/java-ssl-tools\u0007\u001b[30m\u001b(B\u001b[m\r"]
[6.11221, "o", "Installing cert for openjdk 11.0.12 2021-07-20\r\nkeytool: /opt/homebrew/opt/openjdk@11/bin/keytool \r\n"]
[6.790959, "o", "Certificate was added to keystore\r\n"]
[6.812957, "o", "\u001b[2m⏎\u001b(B\u001b[m \r⏎ \r\u001b[K"]
[6.813245, "o", "\u001b[?2004h"]
[6.829273, "o", "\u001b]0;~/r/p/java-ssl-tools\u0007\u001b[30m\u001b(B\u001b[m"]
[6.829303, "o", "\r\u001b[J\u001b[K\r\n\u001b[1;36mjava-ssl-tools\u001b[0m on \u001b[1;35m main\u001b[0m \u001b[K\r\n\u001b[1;32m❯\u001b[0m \u001b[K\r\u001b[C\u001b[C"]
[8.560983, "o", "j\r\u001b[3C"]
[8.561322, "o", "\u001b[30mssl example.com install\r\u001b[3C\u001b[30m\u001b(B\u001b[m"]
[8.56135, "o", "\b\u001b[91mj\u001b[30mssl example.com install\r\u001b[3C\u001b[30m\u001b(B\u001b[m"]
[8.726252, "o", "\u001b[91ms\u001b[30msl example.com install\r\u001b[4C\u001b[30m\u001b(B\u001b[m"]
[8.84535, "o", "\u001b[91ms\u001b[30ml example.com install\r\u001b[5C\u001b[30m\u001b(B\u001b[m"]
[8.981042, "o", "\u001b[91ml\u001b[30m example.com install\r\u001b[6C\u001b[30m\u001b(B\u001b[m"]
[8.981327, "o", "\b\b\b\b\u001b[34mjssl\u001b[30m example.com install\r\u001b[6C\u001b[30m\u001b(B\u001b[m"]
[9.581639, "o", "\u001b[34m example.com install\r\u001b[26C\u001b[30m\u001b(B\u001b[m"]
[9.582224, "o", "\u001b[20D \u001b[36mexample.com\u001b[30m\u001b(B\u001b[m \u001b[36m\u001b[4minstall\r\u001b[26C\u001b[30m\u001b(B\u001b[m"]
[9.956088, "o", "\b\u001b[K\r\u001b[25C"]
[10.105915, "o", "\b\u001b[K\r\u001b[24C"]
[10.24105, "o", "\b\u001b[K\r\u001b[23C"]
[10.36029, "o", "\b\u001b[K\r\u001b[22C"]
[10.495331, "o", "\b\u001b[K\r\u001b[21C"]
[10.6459, "o", "\b\u001b[K\r\u001b[20C"]
[10.991253, "o", "\b\u001b[K\r\u001b[19C"]
[11.383961, "o", "p\r\u001b[20C"]
[11.384219, "o", "\u001b[30ming\r\u001b[20C\u001b[30m\u001b(B\u001b[m"]
[11.384348, "o", "\b\u001b[36mp\u001b[30ming\r\u001b[20C\u001b[30m\u001b(B\u001b[m"]
[11.530658, "o", "\u001b[36mi\u001b[30mng\r\u001b[21C\u001b[30m\u001b(B\u001b[m"]
[11.696108, "o", "\u001b[36mn\u001b[30mg\r\u001b[22C\u001b[30m\u001b(B\u001b[m"]
[11.770115, "o", "\u001b[36mg\r\u001b[23C\u001b[30m\u001b(B\u001b[m"]
[12.491886, "o", "\r\u001b[23C\r\n"]
[12.491974, "o", "\u001b[30m\u001b(B\u001b[m"]
[12.513739, "o", "\u001b[?2004l"]
[12.514527, "o", "\u001b]0;jssl example.com pin ~/r/p/java-ssl-tools\u0007\u001b[30m\u001b(B\u001b[m\r"]
[12.6312, "o", "javac 11.0.12\r\n"]
[13.578768, "o", "Successfully connected to Socket[addr=example.com/93.184.216.34,port=443,localport=64379]\r\n"]
[13.598081, "o", "\u001b[2m⏎\u001b(B\u001b[m \r⏎ \r\u001b[K"]
[13.598378, "o", "\u001b[?2004h"]
[13.614926, "o", "\u001b]0;~/r/p/java-ssl-tools\u0007\u001b[30m\u001b(B\u001b[m"]
[13.614949, "o", "\r\u001b[J\u001b[K\r\n\u001b[1;36mjava-ssl-tools\u001b[0m on \u001b[1;35m main\u001b[0m \u001b[K\r\n\u001b[1;32m❯\u001b[0m \u001b[K\r\u001b[C\u001b[C"]
[16.436931, "o", "\r\n"]
[16.43701, "o", "\u001b[30m\u001b(B\u001b[m\u001b[30m\u001b(B\u001b[m"]
[16.454223, "o", "\u001b[?2004l"]
Binary file added jssl.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 36f73a6

Please sign in to comment.