keytool -genkeypair

Description

Generate a key pair (private key and associated public key certificate).

Command
keytool -genkeypair
Examples
Generate RSA key pair
keytool -genkeypair -alias mykey -keyalg RSA -keysize 2048 -validity 365 -keystore keystore.jks
Generate with specific algorithm
keytool -genkeypair -alias server -keyalg RSA -keysize 4096 -validity 730 -keystore server.jks
Parameters
Parameter Type Required Description
-alias string No Alias name for the key entry
-keyalg string No Key algorithm name (RSA, DSA, EC)
-keysize string No Key bit size
-validity string No Validity number of days
-keystore string No Keystore location
-storepass string No Keystore password
Command Info
Category: Key Generation
Type: Java-Keytool
Views: 12
Status: Active
Tags
keypair certificate generation