Java Keytool Keystore Commands

SSLWiki 56 views 8 slides Feb 22, 2023
Slide 1
Slide 1 of 8
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8

About This Presentation

The Java Keytool is a command-line utility used for managing keystores containing cryptographic keys, X.509 certificates, and other artifacts needed for secure communication and authentication. With the Keytool, users can generate certificate requests and certificate chains, view keys and certificat...


Slide Content

A Simple Guide on Java Keytool Keystore Commands - By SSLWiki.org

Generate Root & Intermediate by Java Keytool Commands Generate a keystore and self-signed certificate: Generate a certificate signing request (CSR) for an existing Java keystore How to Generate a Java key pair and keystore keytool - genkey -alias mydomain - keyalg RSA -keystore keystore.jks - keysize 2048 keytool - certreq -alias mydomain -keystore keystore.jks -file mydomain.csr keytool - genkey - keyalg RSA -alias selfsigned -keystore keystore.jks - storepass password -validity 360 - keysize 2048 https://sslwiki.org/

Import Root & Intermediate by Java Keytool Commands Import a signed primary certificate to an existing Java keystore Import a root CA certificate to an existing Java keystore Import an intermediate CA certificate to an existing Java keystore: keytool -import - trustcacerts -alias intermediate -file intermediate.crt -keystore keystore.jks keytool -import - trustcacerts -alias root -file Thawte.crt -keystore keystore.jks keytool -import - trustcacerts -alias mydomain -file mydomain.crt -keystore keystore.jks https://sslwiki.org/

Java Keytool Commands for Checking Check a particular keystore entry using an alias: Check which certificates are in a Java keystore: Check a stand-alone certificate: keytool - printcert -v -file mydomain.crt keytool -list -v -keystore keystore.jks keytool -list -v -keystore keystore.jks -alias mydomain https://sslwiki.org/

Change Keystore Type by Java Keytool Commands JKS keystore to PFX keystore PFX keystore to JKS keystore: keytool - importkeystore - srckeystore mypfxfile.pfx - srcstoretype pkcs12 - destkeystore newjkskeystore.jks - deststoretype JKS keytool - importkeystore - srckeystore myjksfile.jks - srcstoretype JKS - deststoretype PKCS12 - destkeystore newpfxkeystore.pfx https://sslwiki.org/

Other Useful Java Keytool Commands Export Certificate From a Keystore Java Keystore Password Change Certificate Delete from Java Keytool Keystore keytool –delete –alias mydomain – keystorekeystore.jks keytool – storepasswd –new new_storepass – keystorekeystore.jks keytool –export –alias mydomain –file mydomain.crt – keystorekeystore.jks https://sslwiki.org/ Trusted CA Certs List keytool –list –v –keystore $JAVA_HOME/ jre /lib/security/ cacerts New CA Import into Trusted Certs keytool –import – trustcacerts –file /path/to/ca/ ca.pem –alias CA_ALIAS –keystore $JAVA_HOME/ jre /lib/security/ cacerts

Summary Java Keytool is an essential tool for secure handling of private keys and certificates. It is the primary method to store, protect, and manage the digital keys needed to authenticate a user, server process, or application. With Java Keytool , users can create and maintain their own public-private key pairs and certificates in a local keystore file. Reference URL: https://sslwiki.org/java-keytool-keystore-commands/

Thank You SSLWiki.org https://sslwiki.org/