Cryptography Tutorials - Herong's Tutorial Examples - v5.42, by Herong Yang
No "keytool" Command to Export Keys
This section describes all sub-commands supported by the 'keytool' provided in JDK. There is not 'keytool' sub-command to export keys stored in 'keystore' files.
To figure out how to use "keytool" to export keys (pairs of private keys and public keys), not certificates, out of "keystore" files, I re-examined all sub-commands supported by the "keytool" tool provided in JDK.
The JDK manual gives me the following list of sub-commands, total of 13:
herong> keytool --help -certreq Generating CSR from a key pair entry -changealias Renaming an entry in the keystore file -delete Deleting an entry in the keystore file -exportcert Exporting a certificate entry -genkeypair Generating a new key pair entry -genseckey Generating a secret key entry -help Displaying help information -importcert Importing a certificate into the keystore file -importkeystore Importing all entries from another keystore file -keypasswd Changing the password for an existing entry -list Display all entry names -printcert Print a certificate file -storepasswd Changing the keystore file password
This confirms that keys stored in the key entry in "keystore" files can not be exported into key files using the "keytool" tool.
Table of Contents
Introduction to AES (Advanced Encryption Standard)
DES Algorithm - Illustrated with Java Programs
DES Algorithm Java Implementation
DES Algorithm - Java Implementation in JDK JCE
DES Encryption Operation Modes
PHP Implementation of DES - mcrypt
Blowfish - 8-Byte Block Cipher
Secret Key Generation and Management
Cipher - Secret Key Encryption and Decryption
RSA Implementation using java.math.BigInteger Class
Introduction of DSA (Digital Signature Algorithm)
Java Default Implementation of DSA
Private key and Public Key Pair Generation
PKCS#8/X.509 Private/Public Encoding Standards
Cipher - Public Key Encryption and Decryption
OpenSSL Introduction and Installation
OpenSSL Generating and Managing RSA Keys
OpenSSL Generating and Signing CSR
OpenSSL Validating Certificate Path
"keytool" and "keystore" from JDK
"OpenSSL" Signing CSR Generated by "keytool"
►Migrating Keys from "keystore" to "OpenSSL" Key Files
►No "keytool" Command to Export Keys
"keytool -genkeypair" Generating PrivateKeyEntry
"keytool -exportcert" Exporting PrivateKeyEntry
"keytool -printcert" Printing Certificate Details
"openssl x509" Viewing Certificate Details
"DumpKey.java" Dumping Private Keys Out of "keystore"
"openssl enc" Converting Keys from Binary to PEM
"openssl dsa" Viewing Private and Public Key Pair
Certificate X.509 Standard and DER/PEM Formats
Migrating Keys from "OpenSSL" Key Files to "keystore"