KeyGenerator is a utility for generating secret keys. If you want to generate public/private key pairs, use keytool provided by Java2.
Before running KeyGenerator, make sure that Java2 and JCE 1.2.1 have been installed correctly. Consult the Installation Guide for details.
The usage of KeyGenerator is as follows:
>java enc.KeyGenerator option [arg...]where
option is:
-g [-keyalg algorithm] [-keysize size]
[-alias alias] [-keypass password] [-keystore
store] [-storetype type] [-storepass password]
[-provider provider]:-keyalg: key generation algorithm name, e.g.,
DESede
-keysize: key size in number of bits
-alias: key alias
-keypass: password of the key
-keystore: keystore name
-storetype: type of the keystore, e.g, jceks
-storepass: password of the keystore
-provider: provider name
-h:With the following command, you can generate a triple DES key and
store it in a keystore, where the key alias and password are
key and keypass while the keystore and its
password are keystore and storepass:
>java enc.KeyGenerator -g -keyalg DESede
-alias key
-keypass keypass
-keystore keystore
-storepass storepass