Class KeyStoreCertProvider
- java.lang.Object
-
- de.xima.fc.cryptography.BouncyCastleSupport
-
- de.xima.fc.mail.impl.security.certprovider.KeyStoreCertProvider
-
- All Implemented Interfaces:
IMailSecurityCertProvider
public class KeyStoreCertProvider extends BouncyCastleSupport implements IMailSecurityCertProvider
An email-encryptor key-provider to determine the certificates by a keystore. If no keystore is given, a default one will be created.- Author:
- XIMA MEDIA GmbH
-
-
Field Summary
Fields Modifier and Type Field Description static StringKEYSTORE_FORMAT
-
Constructor Summary
Constructors Constructor Description KeyStoreCertProvider()Creates a provider with a default keystoreKeyStoreCertProvider(File keyStoreFile, String keyStorePassword)Creates a provider with the given keystore-config or default if the config is not valid
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<X509Certificate>findEncryptionCertificate(String emailAddress, Long clientId, IUser user)Finds the certificate for email-encryption for the given email address within the given client.Optional<CertificateBundle>findSignatureCertificateBundle(String emailAddress, Long clientId, IUser user)Finds the certificate bundle containing the private key for email-signing for the given email address within the given client.-
Methods inherited from class de.xima.fc.cryptography.BouncyCastleSupport
buildSignedCertificate, createCMSContentEncryptorBuilder, createContentSigner, createJceKeyTransRecipientInfoGenerator, createKeyFactory, createKeyPairGenerator, createKeyStore, createOpenSSLPKCS8DecryptorProviderBuilder, createPEMKeyConverter, createSignature, createX509CertificateConverter, createX509CertificateFactory
-
-
-
-
Field Detail
-
KEYSTORE_FORMAT
public static final String KEYSTORE_FORMAT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
KeyStoreCertProvider
public KeyStoreCertProvider() throws ExceptionCreates a provider with a default keystore- Throws:
Exception- on errors while opening or creating the keystore
-
-
Method Detail
-
findEncryptionCertificate
public Optional<X509Certificate> findEncryptionCertificate(String emailAddress, Long clientId, IUser user)
Description copied from interface:IMailSecurityCertProviderFinds the certificate for email-encryption for the given email address within the given client.- Specified by:
findEncryptionCertificatein interfaceIMailSecurityCertProvider- Parameters:
emailAddress- the email address to find the certificate forclientId- the ID of the client to find the certificate inuser- the user requesting the certificate- Returns:
- an
Optionalcontaining the foundX509Certificate, or empty if no certificate was found for encrypting mail to the given email address
-
findSignatureCertificateBundle
public Optional<CertificateBundle> findSignatureCertificateBundle(String emailAddress, Long clientId, IUser user)
Description copied from interface:IMailSecurityCertProviderFinds the certificate bundle containing the private key for email-signing for the given email address within the given client.- Specified by:
findSignatureCertificateBundlein interfaceIMailSecurityCertProvider- Parameters:
emailAddress- the email address to find the private key forclientId- the ID of the client to find the private key inuser- the user requesting the private key- Returns:
- an
Optionalcontaining the foundCertificateBundle(with private key), or empty if no private key was found for signing mail from the given email address
-
-