Class KeystoreManager
- java.lang.Object
-
- org.apache.manifoldcf.connectorcommon.keystore.KeystoreManager
-
- All Implemented Interfaces:
IKeystoreManager,ISSLSocketFactoryProducer
public class KeystoreManager extends java.lang.Object implements IKeystoreManager
This interface describes a class that manages keys and certificates in a secure manner. It's built on top of the JDK 1.4+ JSSE integration, and provides all the necessary logic to work well within the ManifoldCF java environment.
-
-
Constructor Summary
Constructors Constructor Description KeystoreManager(java.lang.String passcode)Create the keystore object.KeystoreManager(java.lang.String passcode, java.lang.String base64String)Create the keystore object from an existing base 64 string.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCertificate(java.lang.String alias, java.security.cert.Certificate certificate)Add a certificate to the keystore.java.security.cert.CertificategetCertificate(java.lang.String alias)Read a certificate from the keystore.java.lang.String[]getContents()Grab a list of the aliases in the key store.java.lang.StringgetDescription(java.lang.String alias)For an alias, get some descriptive information from the object in the keystore.java.lang.StringgetHashString()Get a unique hashstring for this keystore.javax.net.ssl.SSLSocketFactorygetSecureSocketFactory()Build a secure socket factory based on this keystore.java.lang.StringgetString()Convert to a base64 string.javax.net.ssl.TrustManager[]getTrustManagers()Get the trust stores for this keystore manager.voidimportCertificate(java.lang.String alias, java.io.InputStream certData)Import a certificate or key into the list.voidremove(java.lang.String alias)Remove a certificate.
-
-
-
Field Detail
-
_rcsid
public static final java.lang.String _rcsid
- See Also:
- Constant Field Values
-
passcode
protected final java.lang.String passcode
-
keystore
protected final java.security.KeyStore keystore
-
-
Constructor Detail
-
KeystoreManager
public KeystoreManager(java.lang.String passcode) throws ManifoldCFExceptionCreate the keystore object.- Throws:
ManifoldCFException
-
KeystoreManager
public KeystoreManager(java.lang.String passcode, java.lang.String base64String) throws ManifoldCFExceptionCreate the keystore object from an existing base 64 string.- Throws:
ManifoldCFException
-
-
Method Detail
-
getHashString
public java.lang.String getHashString() throws ManifoldCFExceptionGet a unique hashstring for this keystore. The hashcode depends only on the certificates in the store.- Specified by:
getHashStringin interfaceIKeystoreManager- Returns:
- the hash string for this keystore.
- Throws:
ManifoldCFException
-
getContents
public java.lang.String[] getContents() throws ManifoldCFExceptionGrab a list of the aliases in the key store.- Specified by:
getContentsin interfaceIKeystoreManager- Returns:
- the list, as a string array.
- Throws:
ManifoldCFException
-
getDescription
public java.lang.String getDescription(java.lang.String alias) throws ManifoldCFExceptionFor an alias, get some descriptive information from the object in the keystore.- Specified by:
getDescriptionin interfaceIKeystoreManager- Parameters:
alias- is the alias name.- Returns:
- a description of what's in the alias.
- Throws:
ManifoldCFException
-
importCertificate
public void importCertificate(java.lang.String alias, java.io.InputStream certData) throws ManifoldCFExceptionImport a certificate or key into the list. The data must be added as binary.- Specified by:
importCertificatein interfaceIKeystoreManager- Parameters:
alias- is the name of the certificate.certData- is the binary data for the certificate.- Throws:
ManifoldCFException
-
getCertificate
public java.security.cert.Certificate getCertificate(java.lang.String alias) throws ManifoldCFExceptionRead a certificate from the keystore.- Specified by:
getCertificatein interfaceIKeystoreManager- Throws:
ManifoldCFException
-
addCertificate
public void addCertificate(java.lang.String alias, java.security.cert.Certificate certificate) throws ManifoldCFExceptionAdd a certificate to the keystore.- Specified by:
addCertificatein interfaceIKeystoreManager- Throws:
ManifoldCFException
-
remove
public void remove(java.lang.String alias) throws ManifoldCFExceptionRemove a certificate.- Specified by:
removein interfaceIKeystoreManager- Parameters:
alias- is the name of the certificate to remove.- Throws:
ManifoldCFException
-
getString
public java.lang.String getString() throws ManifoldCFExceptionConvert to a base64 string.- Specified by:
getStringin interfaceIKeystoreManager- Returns:
- the base64-encoded string. NOTE WELL: as of JDK 1.6, you will not get the same exact string twice from this method -- so it cannot be used for a hash!!
- Throws:
ManifoldCFException
-
getTrustManagers
public javax.net.ssl.TrustManager[] getTrustManagers() throws ManifoldCFExceptionGet the trust stores for this keystore manager.- Specified by:
getTrustManagersin interfaceIKeystoreManager- Throws:
ManifoldCFException
-
getSecureSocketFactory
public javax.net.ssl.SSLSocketFactory getSecureSocketFactory() throws ManifoldCFExceptionBuild a secure socket factory based on this keystore.- Specified by:
getSecureSocketFactoryin interfaceISSLSocketFactoryProducer- Throws:
ManifoldCFException
-
-