| java.lang.Object org.apache.james.security.KeyHolder
KeyHolder | public class KeyHolder (Code) | | Loads a
java.security.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.
version: CVS $Revision: 494012 $ $Date: 2007-01-08 11:23:58 +0100 (Mo, 08 Jan 2007) $ since: 2.2.1 |
Constructor Summary | |
public | KeyHolder(String keyStoreFileName, String keyStorePassword, String keyAlias, String keyAliasPassword, String keyStoreType) Creates a new instance of KeyHolder using
java.security.KeyStore related parameters.
Parameters: keyStoreFileName - The (absolute) file name of the .keystore file to load the keystore from. Parameters: 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. Parameters: 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. Parameters: keyAliasPassword - The password of the alias for recovering the key.If missing (is null) will default to keyStorePassword. |
Method Summary | |
public SMIMESignedGenerator | createGenerator() Creates an SMIMESignedGenerator . | public MimeMultipart | generate(MimeMessage message) Generates a signed MimeMultipart from a MimeMessage.
Parameters: message - The message to sign. | public MimeMultipart | generate(MimeBodyPart content) Generates a signed MimeMultipart from a MimeBodyPart.
Parameters: content - The content to sign. | public CertStore | getCertStore() Getter for property certStore. | public X509Certificate | getCertificate() Getter for property certificate. | public 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. | public PrivateKey | getPrivateKey() Getter for property privateKey. | public static String | getSignerAddress(X509Certificate certificate) Extracts the signer email address (EMAILADDRESS=) from an X509Certificate distinguished name.
Parameters: certificate - The certificate to extract the information from. | public String | getSignerAddress() Getter for property signerAddress. | public static String | getSignerCN(X509Certificate certificate) Extracts the signer common name (CN=) from an X509Certificate distinguished name.
Parameters: certificate - The certificate to extract the information from. | public String | getSignerCN() Getter for property signerCN. | public static String | getSignerDistinguishedName(X509Certificate certificate) Extracts the signer distinguished name (DN) from an X509Certificate .
Parameters: certificate - The certificate to extract the information from. | public String | getSignerDistinguishedName() Getter for property signerDistinguishedName. |
KeyHolder | public KeyHolder(String keyStoreFileName, String keyStorePassword, String keyAlias, String keyAliasPassword, String keyStoreType) throws KeyStoreException, FileNotFoundException, IOException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, CertificateException, UnrecoverableKeyException, NoSuchProviderException(Code) | | Creates a new instance of KeyHolder using
java.security.KeyStore related parameters.
Parameters: keyStoreFileName - The (absolute) file name of the .keystore file to load the keystore from. Parameters: 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. Parameters: 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. Parameters: 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. Parameters: 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. throws: java.security.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. See Also: java.security.KeyStore.getDefaultType See Also: java.security.KeyStore.getInstance(String) See Also: java.security.KeyStore.load See Also: java.security.KeyStore.getKey See Also: java.security.KeyStore.getCertificate |
createGenerator | public SMIMESignedGenerator createGenerator() throws CertStoreException, SMIMEException(Code) | | Creates an SMIMESignedGenerator . Includes a signer private key and certificate,
and a pool of certs and cerls (if any) to go with the signature.
The generated SMIMESignedGenerator. |
getCertStore | public CertStore getCertStore()(Code) | | Getter for property certStore.
Value of property certStore. |
getCertificate | public X509Certificate getCertificate()(Code) | | Getter for property certificate.
Value of property certificate. |
getDefaultType | public static String getDefaultType()(Code) | | 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.
The defaultType, issuing a KeyStore.getDefaultType() . |
getPrivateKey | public PrivateKey getPrivateKey()(Code) | | Getter for property privateKey.
Value of property privateKey. |
getSignerAddress | public static String getSignerAddress(X509Certificate certificate)(Code) | | Extracts the signer email address (EMAILADDRESS=) from an X509Certificate distinguished name.
Parameters: certificate - The certificate to extract the information from. The requested information. See Also: getSignerDistinguishedName(X509Certificate) |
getSignerAddress | public String getSignerAddress()(Code) | | Getter for property signerAddress.
Value of property signerMailAddress. See Also: getSignerAddress(X509Certificate) |
getSignerCN | public static String getSignerCN(X509Certificate certificate)(Code) | | Extracts the signer common name (CN=) from an X509Certificate distinguished name.
Parameters: certificate - The certificate to extract the information from. The requested information. See Also: getSignerDistinguishedName(X509Certificate) |
getSignerCN | public String getSignerCN()(Code) | | Getter for property signerCN.
Value of property signerCN. See Also: getSignerCN(X509Certificate) |
getSignerDistinguishedName | public static String getSignerDistinguishedName(X509Certificate certificate)(Code) | | Extracts the signer distinguished name (DN) from an X509Certificate .
Parameters: certificate - The certificate to extract the information from. The requested information. |
getSignerDistinguishedName | public String getSignerDistinguishedName()(Code) | | Getter for property signerDistinguishedName.
Value of property signerDistinguishedName. See Also: getSignerDistinguishedName(X509Certificate) |
|
|