An open API service indexing awesome lists of open source software.

https://github.com/tomcz/pemtojks

Kotlin command line application to add PEM encoded keys and certificates to Java KeyStores.
https://github.com/tomcz/pemtojks

certificate java-keystore jks kotlin pem

Last synced: 28 days ago
JSON representation

Kotlin command line application to add PEM encoded keys and certificates to Java KeyStores.

Awesome Lists containing this project

README

          

# PEM to JKS

This is a Kotlin command line application that adds PEM-encoded certificates (in X.509 format)
and RSA private keys (in PKCS #8 format) to a Java KeyStore, so that they can be used for
SSL/TLS in Java applications.

## Run the application

To obtain the application bundle you can either build the application using the steps below or download the [latest release](https://github.com/tomcz/pemToJks/releases).

The following example commands are run from the root of the unzipped application bundle.

View help text:

```
$> ./bin/pemToJks -h
usage: pemToJks
-alias Java keystore alias for certificate/key
-aliaspw Java keystore key alias password
-cert Path to PEM certificate file
-h,--help Print this message and exit
-key Path to PEM key file
-store Path to java keystore file
-storepw Java keystore password
```

Add a trusted certificate to a keystore:
NOTE: If the keystore does not exist, it will be created.

```
$> ./bin/pemToJks -cert cert.pem -alias trustme -store test.jks
Reading certificate file
Loading keystore
Adding certificate entry to keystore
Saving keystore
Done
```

Add a certificate chain and private key to a keystore:
NOTE: If the keystore does not exist, it will be created.

```
$> ./bin/pemToJks -cert cert.pem -key key.pem -alias useme -store test.jks
Reading certificate file
Reading key file
Verifying certificate against key
Loading keystore
Adding key & cert chain entry to keystore
Saving keystore
Done
```

## Development

### Requirements

1. Java 11
2. Clone this project

### Build the application

Run the following from the root of the project:

```
make all
```

This creates a `build/distributions/pemToJks.zip` application bundle.