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.
To obtain the application bundle you can either build the application using the steps below or download the latest release.
The following example commands are run from the root of the unzipped application bundle.
View help text:
$> ./bin/pemToJks -h
usage: pemToJks
-alias <arg> Java keystore alias for certificate/key
-aliaspw <arg> Java keystore key alias password
-cert <arg> Path to PEM certificate file
-h,--help Print this message and exit
-key <arg> Path to PEM key file
-store <arg> Path to java keystore file
-storepw <arg> 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
- Java 11
- Clone this project
Run the following from the root of the project:
make all
This creates a build/distributions/pemToJks.zip
application bundle.