org.apache.james.mailet.crypto
Class KeyStoreHolder

java.lang.Object
  extended by org.apache.james.mailet.crypto.KeyStoreHolder

public class KeyStoreHolder
extends 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  KeyStore keyStore
           
 
Constructor Summary
KeyStoreHolder()
           
KeyStoreHolder(String password)
           
KeyStoreHolder(String keyStoreFileName, String keyStorePassword, String keyStoreType)
           
 
Method Summary
 List<SMIMESignerInfo> 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 KeyStore keyStore
Constructor Detail

KeyStoreHolder

public KeyStoreHolder()
               throws IOException,
                      GeneralSecurityException
Throws:
IOException
GeneralSecurityException

KeyStoreHolder

public KeyStoreHolder(String password)
               throws IOException,
                      GeneralSecurityException
Throws:
IOException
GeneralSecurityException

KeyStoreHolder

public KeyStoreHolder(String keyStoreFileName,
                      String keyStorePassword,
                      String keyStoreType)
               throws KeyStoreException,
                      NoSuchAlgorithmException,
                      CertificateException,
                      NoSuchProviderException,
                      IOException
Throws:
KeyStoreException
NoSuchAlgorithmException
CertificateException
NoSuchProviderException
IOException
Method Detail

verifySignatures

public List<SMIMESignerInfo> verifySignatures(org.bouncycastle.mail.smime.SMIMESigned signed)
                                       throws 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:
Exception
javax.mail.MessagingException


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.