java.lang.Object
hk.hku.cecid.phoenix.pki.SMIMEHandler
hk.hku.cecid.phoenix.pki.SMIMEDecrypter
- public class SMIMEDecrypter
- extends SMIMEHandler
A class for decrypting MimeBodyPart that was encrypted by SMIME.
| Fields inherited from class hk.hku.cecid.phoenix.pki.SMIMEHandler |
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
instance
private static SMIMEDecrypter instance
compositeKs
private CompositeKeyStore compositeKs
SMIME_ENCRYPTED
public static final java.lang.String SMIME_ENCRYPTED
- See Also:
- Constant Field Values
SMIMEDecrypter
protected SMIMEDecrypter(java.lang.String keyStorePath,
java.lang.String keyStorePass)
- Constructor.
getInstance
public static SMIMEDecrypter getInstance(java.lang.String keyStorePath,
java.lang.String keyStorePass)
- The application should use this method to get a instance of SMIMEDecrypter
decryptMimeMessage
public javax.mail.internet.MimeMessage decryptMimeMessage(java.lang.String alias,
java.lang.String keyPass,
javax.mail.internet.MimeMessage mimeMessage,
javax.mail.Session session)
throws java.security.KeyStoreException,
java.security.NoSuchAlgorithmException,
java.security.UnrecoverableKeyException,
SMIMEException
- Decrypts a MimeBodyPart that was encrypted by SMIME.
isSMIMEEncrypted
public boolean isSMIMEEncrypted(javax.mail.internet.MimeMessage mimeMessage)
throws javax.mail.MessagingException
- It returns whether the MimeBodyPart is encrypted by SMIME. Note that it
only checks whether the content type string starts with
"application/pkcs7-mime", it does not tell whether the MimeBodyPart can
be correctly decrypted.