No "keytool" Command to Export Keys

This section describes all sub-commands supported by the 'keytool' provided in JDK 1.6. 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 1.6.

The JDK 1.6 manual gives me the following list of sub-commands, total of 13:

keytool usage:

-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 as of JDK 1.6, keys stored in the key entry in "keystore" files can not be exported into key files using the "keytool" tool.

Last update: 2013.

Table of Contents

 About This Book

 Cryptography Terminology

 Cryptography Basic Concepts

 Introduction to AES (Advanced Encryption Standard)

 Introduction to DES Algorithm

 DES Algorithm - Illustrated with Java Programs

 DES Algorithm Java Implementation

 DES Algorithm - Java Implementation in JDK JCE

 DES Encryption Operation Modes

 DES in Stream Cipher Modes

 PHP Implementation of DES - mcrypt

 Blowfish - 8-Byte Block Cipher

 Secret Key Generation and Management

 Cipher - Secret Key Encryption and Decryption

 Introduction of RSA Algorithm

 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

 MD5 Mesasge Digest Algorithm

 SHA1 Mesasge Digest Algorithm

 OpenSSL Introduction and Installation

 OpenSSL Generating and Managing RSA Keys

 OpenSSL Managing Certificates

 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"

 Using Certificates in IE (Internet Explorer)

 Using Certificates in Firefox

 Using Certificates in Google Chrome

 Outdated Tutorials

 References

 PDF Printing Version