The keytool command is included with Java, thus you will need to install Java to use the keytool command.
A keystore contains one or more public / private key pairs (private key / public certificate).
A public / private key pair can be used to encrypt packets being transmitted over the Internet. One of the most popular uses of a public / private key pair is to encrypt the resources being transmitted to clients from a web server. The first step is to create the private key. In this example, the private key is placed on the web server so that HTTPS can be used. As the name implies, a private key is private, and should never ever be made public.
In this example, a keystore named DefaultKeystore.jks is created, with a single private key with an alias of example.com.
keytool -genkey -alias example.com -keyalg RSA -keystore DefaultKeystore.jks -keysize 2048
In this example, a PKCS12 keystore is created.
keytool -genkey -alias example.com -keyalg RSA -keystore DefaultKeystore.p12 -keysize 2048 -storetype PKCS12