|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.james.mailet.crypto.SMIMEKeyHolder
public class SMIMEKeyHolder
Loads a KeyStore in memory and keeps it ready for the
cryptographic activity.
It has the role of being a simpler intermediate to the crypto libraries. Uses specifically the Legion of the Bouncy Castle libraries, particularly for the SMIME activity.
| Constructor Summary | |
|---|---|
SMIMEKeyHolder(String keyStoreFileName,
String keyStorePassword,
String keyAlias,
String keyAliasPassword,
String keyStoreType)
Creates a new instance of KeyHolder using KeyStore related parameters. |
|
| Method Summary | |
|---|---|
org.bouncycastle.mail.smime.SMIMESignedGenerator |
createGenerator()
Creates an SMIMESignedGenerator. |
javax.mail.internet.MimeMultipart |
generate(javax.mail.internet.MimeBodyPart content)
Generates a signed MimeMultipart from a MimeBodyPart. |
javax.mail.internet.MimeMultipart |
generate(javax.mail.internet.MimeMessage message)
Generates a signed MimeMultipart from a MimeMessage. |
X509Certificate |
getCertificate()
Getter for property certificate. |
CertStore |
getCertStore()
Getter for property certStore. |
static String |
getDefaultType()
Returns the default keystore type as specified in the Java security properties file, or the string "jks" (acronym for "Java keystore") if no such property exists. |
PrivateKey |
getPrivateKey()
Getter for property privateKey. |
String |
getSignerAddress()
Getter for property signerAddress. |
static String |
getSignerAddress(X509Certificate certificate)
Extracts the signer email address (EMAILADDRESS=) from an X509Certificate distinguished name. |
String |
getSignerCN()
Getter for property signerCN. |
static String |
getSignerCN(X509Certificate certificate)
Extracts the signer common name (CN=) from an X509Certificate distinguished name. |
String |
getSignerDistinguishedName()
Getter for property signerDistinguishedName. |
static String |
getSignerDistinguishedName(X509Certificate certificate)
Extracts the signer distinguished name (DN) from an X509Certificate. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SMIMEKeyHolder(String keyStoreFileName,
String keyStorePassword,
String keyAlias,
String keyAliasPassword,
String keyStoreType)
throws KeyStoreException,
FileNotFoundException,
IOException,
NoSuchAlgorithmException,
InvalidAlgorithmParameterException,
CertificateException,
UnrecoverableKeyException,
NoSuchProviderException
KeyHolder using KeyStore related parameters.
keyStoreFileName - The (absolute) file name of the .keystore file to load the keystore from.keyStorePassword - The (optional) password used to check the integrity of the keystore.
If given, it is used to check the integrity of the keystore data,
otherwise, if null, the integrity of the keystore is not checked.keyAlias - The alias name of the key.
If missing (is null) and if there is only one key in the keystore, will default to it.keyAliasPassword - The password of the alias for recovering the key.
If missing (is null) will default to keyStorePassword. At least one of the passwords must be provided.keyStoreType - The type of keystore.
If missing (is null) will default to the keystore type as specified in the Java security properties file,
or the string "jks" (acronym for "Java keystore") if no such property exists.
KeyStoreException - Thrown when the keyAlias is specified and not found,
or is not specified and either no alias is found or more than one is found.
FileNotFoundException
IOException
NoSuchAlgorithmException
InvalidAlgorithmParameterException
CertificateException
UnrecoverableKeyException
NoSuchProviderExceptionKeyStore.getDefaultType(),
KeyStore.getInstance(String),
KeyStore.load(java.io.InputStream, char[]),
KeyStore.getKey(java.lang.String, char[]),
KeyStore.getCertificate(java.lang.String)| Method Detail |
|---|
public static String getDefaultType()
KeyStore.getDefaultType().public PrivateKey getPrivateKey()
public X509Certificate getCertificate()
public CertStore getCertStore()
public org.bouncycastle.mail.smime.SMIMESignedGenerator createGenerator()
throws CertStoreException,
org.bouncycastle.mail.smime.SMIMEException
SMIMESignedGenerator. Includes a signer private key and certificate,
and a pool of certs and cerls (if any) to go with the signature.
CertStoreException
org.bouncycastle.mail.smime.SMIMEException
public javax.mail.internet.MimeMultipart generate(javax.mail.internet.MimeMessage message)
throws CertStoreException,
NoSuchAlgorithmException,
NoSuchProviderException,
org.bouncycastle.mail.smime.SMIMEException
generate in interface KeyHoldermessage - The message to sign.
MimeMultipart.
CertStoreException
NoSuchAlgorithmException
NoSuchProviderException
org.bouncycastle.mail.smime.SMIMEException
public javax.mail.internet.MimeMultipart generate(javax.mail.internet.MimeBodyPart content)
throws CertStoreException,
NoSuchAlgorithmException,
NoSuchProviderException,
org.bouncycastle.mail.smime.SMIMEException
generate in interface KeyHoldercontent - The content to sign.
MimeMultipart.
CertStoreException
NoSuchAlgorithmException
NoSuchProviderException
org.bouncycastle.mail.smime.SMIMEExceptionpublic static String getSignerDistinguishedName(X509Certificate certificate)
X509Certificate.
certificate - The certificate to extract the information from.
public static String getSignerCN(X509Certificate certificate)
X509Certificate distinguished name.
certificate - The certificate to extract the information from.
getSignerDistinguishedName(X509Certificate)public static String getSignerAddress(X509Certificate certificate)
X509Certificate distinguished name.
certificate - The certificate to extract the information from.
getSignerDistinguishedName(X509Certificate)public String getSignerDistinguishedName()
getSignerDistinguishedName in interface KeyHoldergetSignerDistinguishedName(X509Certificate)public String getSignerCN()
getSignerCN in interface KeyHoldergetSignerCN(X509Certificate)public String getSignerAddress()
getSignerAddress in interface KeyHoldergetSignerAddress(X509Certificate)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||