org.apache.manifoldcf.core.keystore
Class KeystoreManager

java.lang.Object
  extended by org.apache.manifoldcf.core.keystore.KeystoreManager
All Implemented Interfaces:
IKeystoreManager

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.


Field Summary
static java.lang.String _rcsid
           
protected  java.security.KeyStore keystore
           
protected  java.lang.String passcode
           
 
Constructor Summary
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
 void addCertificate(java.lang.String alias, java.security.cert.Certificate certificate)
          Add a certificate to the keystore.
 java.security.cert.Certificate getCertificate(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.String getDescription(java.lang.String alias)
          For an alias, get some descriptive information from the object in the keystore.
 javax.net.ssl.SSLSocketFactory getSecureSocketFactory()
          Build a secure socket factory based on this keystore.
 java.lang.String getString()
          Convert to a base64 string.
 void importCertificate(java.lang.String alias, java.io.InputStream certData)
          Import a certificate or key into the list.
 void remove(java.lang.String alias)
          Remove a certificate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_rcsid

public static final java.lang.String _rcsid
See Also:
Constant Field Values

passcode

protected java.lang.String passcode

keystore

protected java.security.KeyStore keystore
Constructor Detail

KeystoreManager

public KeystoreManager(java.lang.String passcode)
                throws ManifoldCFException
Create the keystore object.

Throws:
ManifoldCFException

KeystoreManager

public KeystoreManager(java.lang.String passcode,
                       java.lang.String base64String)
                throws ManifoldCFException
Create the keystore object from an existing base 64 string.

Throws:
ManifoldCFException
Method Detail

getContents

public java.lang.String[] getContents()
                               throws ManifoldCFException
Grab a list of the aliases in the key store.

Specified by:
getContents in interface IKeystoreManager
Returns:
the list, as a string array.
Throws:
ManifoldCFException

getDescription

public java.lang.String getDescription(java.lang.String alias)
                                throws ManifoldCFException
For an alias, get some descriptive information from the object in the keystore.

Specified by:
getDescription in interface IKeystoreManager
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 ManifoldCFException
Import a certificate or key into the list. The data must be added as binary.

Specified by:
importCertificate in interface IKeystoreManager
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 ManifoldCFException
Read a certificate from the keystore.

Specified by:
getCertificate in interface IKeystoreManager
Throws:
ManifoldCFException

addCertificate

public void addCertificate(java.lang.String alias,
                           java.security.cert.Certificate certificate)
                    throws ManifoldCFException
Add a certificate to the keystore.

Specified by:
addCertificate in interface IKeystoreManager
Throws:
ManifoldCFException

remove

public void remove(java.lang.String alias)
            throws ManifoldCFException
Remove a certificate.

Specified by:
remove in interface IKeystoreManager
Parameters:
alias - is the name of the certificate to remove.
Throws:
ManifoldCFException

getString

public java.lang.String getString()
                           throws ManifoldCFException
Convert to a base64 string.

Specified by:
getString in interface IKeystoreManager
Returns:
the base64-encoded string.
Throws:
ManifoldCFException

getSecureSocketFactory

public javax.net.ssl.SSLSocketFactory getSecureSocketFactory()
                                                      throws ManifoldCFException
Build a secure socket factory based on this keystore.

Specified by:
getSecureSocketFactory in interface IKeystoreManager
Throws:
ManifoldCFException