"keytool -keyclone" - Cloning Certificates with New Identities

This section provides a tutorial example on how to use the 'keytool -keyclone' command to clone a certificate with new identity. The cloned certificates with share the same keys with the original certificate.

In the third example, I want to create a new key entry with the same key pair of an existing key entry, but change the identity information:

herong> keytool -keyclone -alias my_home -dest my_copy -keypass My1stKey
   -new My2ndKey -keystore herong.jks -storepass HerongJKS

herong> keytool -selfcert -alias my_copy -keypass My2ndKey
   -dname "cn=Herong Yang, ou=My Unit 2, o=My Organization 2, c=US"
   -keystore herong.jks -storepass HerongJKS

herong> keytool -exportcert -alias my_copy -file my_copy.crt
   -keystore herong.jks -storepass HerongJKS

Certificate stored in file <my_copy.crt>

herong> keytool -printcert -file my_copy.crt
Owner: CN=Herong Yang, OU=My Unit 2, O=My Organization 2, C=US
Issuer: CN=Herong Yang, OU=My Unit 2, O=My Organization 2, C=US
Serial number: 40798b4f
Valid from: Sun Jul 1 14:15:43 EDT 2018 until: Sat Aug 31 14:15:43...
Certificate fingerprints:
         MD5:  4A:E4:D9:BC:E9:8C:50:27:6C:00:59:76:D1:14:05:79
         SHA1: FA:F5:30:78:22:3B:52:28:0D:41:24:0B:CA:CC:6F:D4:0E:...

Table of Contents

 About This JDK Tutorial Book

 JDK (Java Development Kit)

 Java Date-Time API

 Date, Time and Calendar Classes

 Date and Time Object and String Conversion

 Number Object and Numeric String Conversion

 Locales, Localization Methods and Resource Bundles

 Calling and Importing Classes Defined in Unnamed Packages

 HashSet, Vector, HashMap and Collection Classes

 Character Set Encoding Classes and Methods

 Character Set Encoding Maps

 Encoding Conversion Programs for Encoded Text Files

 Java Logging

 Socket Network Communication

 Datagram Network Communication

 DOM (Document Object Model) - API for XML Files

 SAX (Simple API for XML)

 DTD (Document Type Definition) - XML Validation

 XSD (XML Schema Definition) - XML Validation

 XSL (Extensible Stylesheet Language)

 Message Digest Algorithm Implementations in JDK

 Private key and Public Key Pair Generation

 PKCS#8/X.509 Private/Public Encoding Standards

 Digital Signature Algorithm and Sample Program

"keytool" Commands and "keystore" Files

 Certificates and Certificate Chains

 What Is "keystore"?

 "keytool" - Key and Certificate Management Tool

 "keytool -genkeypair" - Generating Keys and Self-Signed Certificates

 "keystore" File Type: PKCS12 and JKS

 "keytool -export/import" - Exporting and Importing Certificates

"keytool -keyclone" - Cloning Certificates with New Identities

 KeyStore and Certificate Classes

 Secret Key Generation and Management

 Cipher - Encryption and Decryption

 The SSL (Secure Socket Layer) Protocol

 SSL Socket Communication Testing Programs

 SSL Client Authentication

 HTTPS (Hypertext Transfer Protocol Secure)

 Outdated Tutorials

 References

 Full Version in PDF/EPUB