public class DumpKeyStore
extends java.lang.Object
This class may be used to dump through all key and cert entries of a key store and write their keys/certificates to a directory into several formats (PKCS#12, PKCS#7, single X.509).
 The key entries (and corresponding certificate chains) are written as
 PKCS#12, PKCS#7 and X.509 DER files into a keys sub-directory,
 the certificate entries are written as X.509 DER files into a
 certs sub-directory.
 
The same password must be used for the key store and all its key entries.
Usage example:
java DumpKeyStore keystore.ks certs/ks password IAIKKeyStore
| Constructor and Description | 
|---|
| DumpKeyStore()Default Constructor. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | dump(java.lang.String keyStoreFile,
    java.lang.String outDirName,
    char[] password,
    java.lang.String keyStoreType)Dumps a key store. | 
| static void | main(java.lang.String[] args)Main method. | 
| static void | saveCertificateChain(X509Certificate[] certChain,
                    java.lang.String fileName,
                    boolean DER_Format,
                    boolean makePKCS7List,
                    boolean fullChain)Saves the supplied certificate chain to the given file. | 
| static void | saveToPKCS12(java.lang.String friendlyName,
            X509Certificate[] certChain,
            java.security.PrivateKey privateKey,
            java.lang.String fileName,
            boolean DER_Format,
            char[] password,
            boolean fullChain)Saves the supplied certificate chain and private key to the given file in
 PKCS#12 format. | 
public void dump(java.lang.String keyStoreFile,
                 java.lang.String outDirName,
                 char[] password,
                 java.lang.String keyStoreType)
outDirName directory
 into several formats (PKCS#12, PKCS#7, single X.509).
 
 The key entries (and corresponding certificate chains) are written as
 PKCS#12, PKCS#7 and X.509 DER files into a keys sub-directory,
 the certificate entries are written as X.509 DER files into a
 certs sub-directory.
keyStoreFile - the name of the key store fileoutDirName - the directory to which to write the PKCS#12, PKCS#7 and cert filespassword - the keystore passwordkeyStoreType - the key store typepublic static void saveCertificateChain(X509Certificate[] certChain, java.lang.String fileName, boolean DER_Format, boolean makePKCS7List, boolean fullChain) throws java.io.IOException
certChain - the certificate chain to be savedfileName - the file to write toDER_Format - true if to save in DER format, false if
          to save in PEM formatmakePKCS7List - whether to save a PKCS7 List or notfullChain - whether to save the full chain or notjava.io.IOException - if an IOException occurs during savingpublic static void saveToPKCS12(java.lang.String friendlyName,
                                X509Certificate[] certChain,
                                java.security.PrivateKey privateKey,
                                java.lang.String fileName,
                                boolean DER_Format,
                                char[] password,
                                boolean fullChain)
                         throws java.io.IOException
friendlyName - the friendly name (keystore alias) to be usedcertChain - the certificate chain to be savedprivateKey - the private key to be savedfileName - the file to write toDER_Format - true if to save in DER format, false if
          to save in PEM formatpassword - the password to protect the PKCS#12 filefullChain - whether to save the full chain or notjava.io.IOExceptionpublic static void main(java.lang.String[] args)