Platform SDK Java 8.5 API Reference

com.genesyslab.platform.commons.connection.tls
Class KeyStoreFactory

java.lang.Object
  extended by com.genesyslab.platform.commons.connection.tls.KeyStoreFactory

public class KeyStoreFactory
extends java.lang.Object

Utility class, provides methods to create and tune key stores.


Field Summary
static java.lang.String DEFAULT_CERT_ALIAS
          Default entry alias used when creating KeyStore from *.PEM certificate and private key
static char[] DEFAULT_PASSWORD
          Default entry password used when creating KeyStore from *.PEM CA certificate
static java.lang.String DEFAULT_TRUST_CERT_ALIAS
          Default entry alias used when creating KeyStore from *.PEM CA certificate
 
Constructor Summary
KeyStoreFactory()
           
 
Method Summary
static java.security.KeyStore createJKSKeyStore(java.io.InputStream jksStream, char[] keyStorePassword)
          Loads Java Key Store (JKS) from file.
static java.security.KeyStore createMSCAPIMyStore(javax.security.auth.callback.CallbackHandler keyStoreCallbackHandler)
          Creates instance of Windows Certificate Services (WCS) user personal certificates key store
static java.security.KeyStore createMSCAPIRootStore(javax.security.auth.callback.CallbackHandler keyStoreCallbackHandler)
          Creates instance of Windows Certificate Services (WCS) user trusted root key store
static java.security.KeyStore createPEMCertKeyStore(java.security.cert.Certificate[] certChain, java.security.PrivateKey key)
          Creates instance of in-memory collection-based certificate/key key store
static java.security.KeyStore createPEMTrustKeyStore(java.security.cert.Certificate trustCert)
          Creates instance of in-memory collection-based trust key store
static java.security.KeyStore createPKCS11KeyStore(javax.security.auth.callback.CallbackHandler keyStoreCallbackHandler)
          Creates instance of PKCS#11 key store
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CERT_ALIAS

public static final java.lang.String DEFAULT_CERT_ALIAS
Default entry alias used when creating KeyStore from *.PEM certificate and private key

See Also:
Constant Field Values

DEFAULT_TRUST_CERT_ALIAS

public static final java.lang.String DEFAULT_TRUST_CERT_ALIAS
Default entry alias used when creating KeyStore from *.PEM CA certificate

See Also:
Constant Field Values

DEFAULT_PASSWORD

public static final char[] DEFAULT_PASSWORD
Default entry password used when creating KeyStore from *.PEM CA certificate

Constructor Detail

KeyStoreFactory

public KeyStoreFactory()
Method Detail

createPKCS11KeyStore

public static java.security.KeyStore createPKCS11KeyStore(javax.security.auth.callback.CallbackHandler keyStoreCallbackHandler)
                                                   throws java.security.GeneralSecurityException,
                                                          java.io.IOException
Creates instance of PKCS#11 key store

Parameters:
keyStoreCallbackHandler - CallbackHandler instance used to provide password to access key store.
Returns:
Configured KeyStore instance
Throws:
java.security.GeneralSecurityException - If there are problems accessing key store
java.io.IOException - If there are problems accessing key store

createMSCAPIRootStore

public static java.security.KeyStore createMSCAPIRootStore(javax.security.auth.callback.CallbackHandler keyStoreCallbackHandler)
                                                    throws java.security.GeneralSecurityException,
                                                           java.io.IOException
Creates instance of Windows Certificate Services (WCS) user trusted root key store

Parameters:
keyStoreCallbackHandler - CallbackHandler instance used to provide password to access key store.
Returns:
Configured KeyStore instance
Throws:
java.security.GeneralSecurityException - If there are problems accessing key store
java.io.IOException - If there are problems accessing key store

createMSCAPIMyStore

public static java.security.KeyStore createMSCAPIMyStore(javax.security.auth.callback.CallbackHandler keyStoreCallbackHandler)
                                                  throws java.security.GeneralSecurityException,
                                                         java.io.IOException
Creates instance of Windows Certificate Services (WCS) user personal certificates key store

Parameters:
keyStoreCallbackHandler - CallbackHandler instance used to provide password to access key store.
Returns:
Configured KeyStore instance
Throws:
java.security.GeneralSecurityException - If there are problems accessing key store
java.io.IOException - If there are problems accessing key store

createPEMTrustKeyStore

public static java.security.KeyStore createPEMTrustKeyStore(java.security.cert.Certificate trustCert)
                                                     throws java.security.GeneralSecurityException,
                                                            java.io.IOException
Creates instance of in-memory collection-based trust key store

Parameters:
trustCert - Certificate to be stored as a trusted certificate entry
Returns:
Configured KeyStore instance
Throws:
java.security.GeneralSecurityException - If there are problems creating key store
java.io.IOException - If there are problems creating key store

createPEMCertKeyStore

public static java.security.KeyStore createPEMCertKeyStore(java.security.cert.Certificate[] certChain,
                                                           java.security.PrivateKey key)
                                                    throws java.security.GeneralSecurityException,
                                                           java.io.IOException
Creates instance of in-memory collection-based certificate/key key store

Parameters:
certChain - Certificate chain to be stored together with private key in a "private key" entry
key - Private Key to be stored together with certificate chain in a "private key" entry
Returns:
Configured KeyStore instance
Throws:
java.security.GeneralSecurityException - If there are problems creating key store
java.io.IOException - If there are problems creating key store

createJKSKeyStore

public static java.security.KeyStore createJKSKeyStore(java.io.InputStream jksStream,
                                                       char[] keyStorePassword)
                                                throws java.security.GeneralSecurityException,
                                                       java.io.IOException
Loads Java Key Store (JKS) from file. Unlike other key store types, JKS needs explicit passwords, Java API does not allow to wrap them in CallbackHandler objects.

Parameters:
jksStream - Stream to load from
keyStorePassword - Password to access key store
Returns:
Configured KeyStore instance
Throws:
java.security.GeneralSecurityException - If there are problems accessing key store
java.io.IOException - If there are problems loading key store

Platform SDK Java 8.5 API Reference

Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 8.5.302.00
Copyright © 2006–2017 Genesys Telecommunications Laboratories, Inc. All rights reserved.