org.apache.james.security
Class KeyStoreHolder

java.lang.Object
  extended by org.apache.james.security.KeyStoreHolder

public class KeyStoreHolder
extends java.lang.Object

This class is used to handle in a simple way a keystore that contains a set of trusted certificates. It loads the set from the specified keystore (type, location and password are supplied during the object's creation) and it is able to verify a s/mime signature, also checking if the signer's certificate is trusted or not.


Field Summary
protected  java.security.KeyStore keyStore
           
 
Constructor Summary
KeyStoreHolder()
           
KeyStoreHolder(java.lang.String password)
           
KeyStoreHolder(java.lang.String keyStoreFileName, java.lang.String keyStorePassword, java.lang.String keyStoreType)
           
 
Method Summary
 java.util.List verifySignatures(org.bouncycastle.mail.smime.SMIMESigned signed)
          Verifies the signature of a SMIME message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keyStore

protected java.security.KeyStore keyStore
Constructor Detail

KeyStoreHolder

public KeyStoreHolder()
               throws java.io.IOException,
                      java.security.GeneralSecurityException
Throws:
java.io.IOException
java.security.GeneralSecurityException

KeyStoreHolder

public KeyStoreHolder(java.lang.String password)
               throws java.io.IOException,
                      java.security.GeneralSecurityException
Throws:
java.io.IOException
java.security.GeneralSecurityException

KeyStoreHolder

public KeyStoreHolder(java.lang.String keyStoreFileName,
                      java.lang.String keyStorePassword,
                      java.lang.String keyStoreType)
               throws java.security.KeyStoreException,
                      java.security.NoSuchAlgorithmException,
                      java.security.cert.CertificateException,
                      java.security.NoSuchProviderException,
                      java.io.IOException
Throws:
java.security.KeyStoreException
java.security.NoSuchAlgorithmException
java.security.cert.CertificateException
java.security.NoSuchProviderException
java.io.IOException
Method Detail

verifySignatures

public java.util.List verifySignatures(org.bouncycastle.mail.smime.SMIMESigned signed)
                                throws java.lang.Exception,
                                       javax.mail.MessagingException
Verifies the signature of a SMIME message. It checks also if the signer's certificate is trusted using the loaded keystore as trusted certificate store.

Parameters:
signed - the signed mail to check.
Returns:
a list of SMIMESignerInfo which keeps the data of each mail signer.
Throws:
java.lang.Exception
javax.mail.MessagingException


Copyright © 2002-2007 The Apache Software Foundation. All Rights Reserved.