public class IdentityStore extends CertificateStore
configuration, PROVIDER, store
Constructor and Description |
---|
IdentityStore(CertificateStoreConfiguration configuration,
boolean createIfAbsent) |
Modifier and Type | Method and Description |
---|---|
void |
addSelfSignedDomainCertificate(String algorithm)
Populates the key store with a self-signed certificate for the domain of this XMPP service.
|
boolean |
containsDomainCertificate(String algorithm)
Checks if the store contains a certificate of a particular algorithm that matches the domain of this
XMPP service.
|
protected boolean |
corresponds(String alias,
List<X509Certificate> certificates) |
void |
ensureDomainCertificates(String... algorithms)
Adds a self-signed certificate for the domain of this XMPP service when no certificate for the domain (of the
provided algorithm) was found.
|
String |
generateCSR(String alias)
Creates a Certificate Signing Request based on the private key and certificate identified by the provided alias.
|
protected static KeyPair |
generateKeyPair(String algorithm,
int keySize)
Returns a new public & private key with the specified algorithm (e.g.
|
String |
installCertificate(String pemCertificates,
String pemPrivateKey,
String passPhrase)
Imports a certificate and the private key that was used to generate the certificate.
|
void |
installCertificate(String alias,
String pemCertificates,
String pemPrivateKey,
String passPhrase)
Imports a certificate and the private key that was used to generate the certificate.
|
void |
installCSRReply(String alias,
String pemCertificates)
Imports a certificate (and its chain) in this store.
|
static boolean |
isForThisDomain(X509Certificate certificate)
Verifies that the subject of the certificate matches the domain of this XMPP service.
|
delete, getAllCertificates, getConfiguration, getStore, persist, reload
public IdentityStore(CertificateStoreConfiguration configuration, boolean createIfAbsent) throws CertificateStoreConfigException
CertificateStoreConfigException
public String generateCSR(String alias) throws CertificateStoreConfigException
alias
- An identifier for a private key / certificate in this store (cannot be null).CertificateStoreConfigException
public void installCSRReply(String alias, String pemCertificates) throws CertificateStoreConfigException
pemCertificates
- a PEM representation of the certificate or certificate chain (cannot be null or empty).CertificateStoreConfigException
protected boolean corresponds(String alias, List<X509Certificate> certificates) throws KeyStoreException, UnrecoverableKeyException, NoSuchAlgorithmException
public String installCertificate(String pemCertificates, String pemPrivateKey, String passPhrase) throws CertificateStoreConfigException
pemCertificates
- a PEM representation of the certificate or certificate chain (cannot be null or empty).pemPrivateKey
- a PEM representation of the private key (cannot be null or empty).passPhrase
- optional pass phrase (must be present if the private key is encrypted).CertificateStoreConfigException
public void installCertificate(String alias, String pemCertificates, String pemPrivateKey, String passPhrase) throws CertificateStoreConfigException
alias
- the name (key) under which the certificate is to be stored in the store (cannot be null or empty).pemCertificates
- a PEM representation of the certificate or certificate chain (cannot be null or empty).pemPrivateKey
- a PEM representation of the private key (cannot be null or empty).passPhrase
- optional pass phrase (must be present if the private key is encrypted).CertificateStoreConfigException
public void ensureDomainCertificates(String... algorithms) throws CertificateStoreConfigException
for ( String algorithm : algorithms ) { if ( !containsDomainCertificate( algorithm ) ) { addSelfSignedDomainCertificate( algorithm ); } }
algorithms
- The algorithms for which to verify / add a domain certificate.CertificateStoreConfigException
public boolean containsDomainCertificate(String algorithm) throws CertificateStoreConfigException
CertificateStoreConfigException
public void addSelfSignedDomainCertificate(String algorithm) throws CertificateStoreConfigException
CertificateStoreConfigException
protected static KeyPair generateKeyPair(String algorithm, int keySize) throws GeneralSecurityException
algorithm
- DSA, RSA, etc.keySize
- the desired key size. This is an algorithm-specific metric, such as modulus length, specified in number of bits.GeneralSecurityException
public static boolean isForThisDomain(X509Certificate certificate)
certificate
- The certificate to verify (cannot be null)Copyright © 2003-2008 Jive Software.