public class IdentityStore extends CertificateStore
configuration, PROVIDER, store
Constructor and Description |
---|
IdentityStore(CertificateStoreConfiguration configuration,
boolean createIfAbsent) |
Modifier and Type | Method and Description |
---|---|
void |
addSelfSignedDomainCertificate()
Populates the key store with a self-signed certificate for the domain of this XMPP service.
|
void |
addSelfSignedDomainCertificate(String algorithm)
Deprecated.
Unused as of Openfire 4.3.0. Use 'addSelfSignedDomainCertificate' instead. See OF-1599.
|
boolean |
containsAllIdentityCertificate()
Checks if the store contains a certificate of a particular algorithm that contains at least all of the identities
of this server (which includes the XMPP domain name, but also its hostname, and XMPP addresses of components
that are currently being hosted).
|
boolean |
containsAllIdentityCertificate(String algorithm)
Deprecated.
Unused as of Openfire 4.3.0. Use 'containsAllIdentityCertificate' instead. See OF-1599.
|
boolean |
containsDomainCertificate()
Checks if the store contains a certificate of a particular algorithm that matches the domain of this
XMPP service.
|
boolean |
containsDomainCertificate(String algorithm)
Deprecated.
Unused as of Openfire 4.3.0. Use 'containsDomainCertificate' instead. See OF-1599.
|
protected boolean |
corresponds(String alias,
List<X509Certificate> certificates) |
void |
ensureDomainCertificate()
Adds a self-signed certificate for the domain of this XMPP service when no certificate for the domain was found.
|
void |
ensureDomainCertificates(String... algorithms)
Deprecated.
Unused as of Openfire 4.3.0. Use 'ensureDomainCertificate' instead. See OF-1599.
|
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.
|
protected String |
generateUniqueAlias()
Generates an alias that is currently unused in this store.
|
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.
|
protected void |
removeAllDomainEntries()
Removes all entries that reflect the local domain.
|
String |
replaceCertificate(String pemCertificates,
String pemPrivateKey,
String passPhrase)
Imports a certificate and the private key that was used to generate the certificate, replacing any previously
installed entries for the same domain.
|
backup, 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
- if there was a problem generating the CSRpublic void installCSRReply(String alias, String pemCertificates) throws CertificateStoreConfigException
alias
- the certificate aliaspemCertificates
- a PEM representation of the certificate or certificate chain (cannot be null or empty).CertificateStoreConfigException
- if there was a problem installing the certificateprotected boolean corresponds(String alias, List<X509Certificate> certificates) throws KeyStoreException, UnrecoverableKeyException, NoSuchAlgorithmException
public String replaceCertificate(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
- if there was a problem replacing the certificatepublic 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
- if there was a problem installing the certificatepublic 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
- if there was a problem installing the certificatepublic void ensureDomainCertificate() throws CertificateStoreConfigException
CertificateStoreConfigException
- if there was a problem creating the certificate@Deprecated 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
- if there was a problem creating the certificatepublic boolean containsDomainCertificate() throws CertificateStoreConfigException
true
if the store contains a certificate of a particular algorithm that matches the domain of this XMPP service, otherwise false
CertificateStoreConfigException
- if there was a problem creating the certificate@Deprecated public boolean containsDomainCertificate(String algorithm) throws CertificateStoreConfigException
algorithm
- An optional algorithm constraint (eg: "RSA"). Can be null, cannot be empty.true
if the store contains a certificate of a particular algorithm that matches the domain of this XMPP service, otherwise false
CertificateStoreConfigException
- if there was a problem creating the certificatepublic boolean containsAllIdentityCertificate() throws CertificateStoreConfigException
true
if the store contains a certificate of a particular algorithm that contains at least all of the identities of this server, otherwise false
CertificateStoreConfigException
- if there was a problem accessing the certificates@Deprecated public boolean containsAllIdentityCertificate(String algorithm) throws CertificateStoreConfigException
algorithm
- An optional algorithm constraint (eg: "RSA"). Can be null, cannot be empty.true
if a certiicate contains all identities for this server, otherwise false
}CertificateStoreConfigException
- if a self-signed certificate could not be createdpublic void addSelfSignedDomainCertificate() throws CertificateStoreConfigException
CertificateStoreConfigException
- if a self-signed certificate could not be created@Deprecated public void addSelfSignedDomainCertificate(String algorithm) throws CertificateStoreConfigException
algorithm
- An optional algorithm constraint (eg: "RSA"). Can be null, cannot be empty.CertificateStoreConfigException
- if a self-signed certificate could not be createdprotected 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
- if the supplied algorithm does not have a key-pair generatorpublic static boolean isForThisDomain(X509Certificate certificate)
certificate
- The certificate to verify (cannot be null)protected String generateUniqueAlias() throws CertificateStoreConfigException
CertificateStoreConfigException
- if a unique alias could not be generatedprotected void removeAllDomainEntries() throws KeyStoreException
KeyStoreException
- if the key store could not be updatedCopyright © 2003–2020 Ignite Realtime. All rights reserved.