Class AcmeClientSpi
java.lang.Object
org.wildfly.security.x500.cert.acme.AcmeClientSpi
SPI for an Automatic Certificate Management Environment (ACME)
client provider to implement.
- Since:
- 1.5.0
- Author:
- Farah Juma
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe default key size that will be used if the key algorithm name is EC.static final StringThe default key algorithm name.static final intThe default key size that will be used if the key algorithm name is not EC. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidchangeAccountKey(AcmeAccount account, boolean staging) Change the key that is associated with the given ACME account.voidchangeAccountKey(AcmeAccount account, boolean staging, X509Certificate certificate, PrivateKey privateKey) Change the key that is associated with the given ACME account.abstract voidcleanupAfterChallenge(AcmeAccount account, AcmeChallenge challenge) Undo the actions that were taken to prove control of the identifier associated with the given challenge.booleancreateAccount(AcmeAccount account, boolean staging) Create an account with an ACME server using the given account information.booleancreateAccount(AcmeAccount account, boolean staging, boolean onlyReturnExisting) Create an account with an ACME server using the given account information.createAuthorization(AcmeAccount account, boolean staging, String domainName) Create an authorization for the given identifier.voiddeactivateAccount(AcmeAccount account, boolean staging) Deactivate the given ACME account.voiddeactivateAuthorization(AcmeAccount account, boolean staging, String authorizationUrl) Deactivate an authorization.getMetadata(AcmeAccount account, boolean staging) Get the metadata associated with the ACME server.byte[]getNewNonce(AcmeAccount account, boolean staging) Get a new nonce for the given account from the ACME server.getResourceUrls(AcmeAccount account, boolean staging) Get the resource URLs needed to perform operations from the ACME server.obtainCertificateChain(AcmeAccount account, boolean staging, String... domainNames) Obtain a certificate chain using the given ACME account.obtainCertificateChain(AcmeAccount account, boolean staging, String keyAlgorithmName, int keySize, String... domainNames) Obtain a certificate chain using the given ACME account.abstract AcmeChallengeproveIdentifierControl(AcmeAccount account, List<AcmeChallenge> challenges) Prove control of the identifier associated with the given list of challenges.voidrevokeCertificate(AcmeAccount account, boolean staging, X509Certificate certificate) Revoke the given certificate.voidrevokeCertificate(AcmeAccount account, boolean staging, X509Certificate certificate, CRLReason reason) Revoke the given certificate.voidupdateAccount(AcmeAccount account, boolean staging, boolean termsOfServiceAgreed) Update whether or not the terms of service have been agreed to for an account with an ACME server.voidupdateAccount(AcmeAccount account, boolean staging, boolean termsOfServiceAgreed, String[] contactUrls) Update an account with an ACME server using the given account information.voidupdateAccount(AcmeAccount account, boolean staging, String[] contactUrls) Update the contact URLs for an account with an ACME server.
-
Field Details
-
DEFAULT_EC_KEY_SIZE
public static final int DEFAULT_EC_KEY_SIZEThe default key size that will be used if the key algorithm name is EC.- See Also:
-
DEFAULT_KEY_SIZE
public static final int DEFAULT_KEY_SIZEThe default key size that will be used if the key algorithm name is not EC.- See Also:
-
DEFAULT_KEY_ALGORITHM_NAME
The default key algorithm name.- See Also:
-
-
Constructor Details
-
AcmeClientSpi
public AcmeClientSpi()
-
-
Method Details
-
getResourceUrls
public Map<AcmeResource,URL> getResourceUrls(AcmeAccount account, boolean staging) throws AcmeException Get the resource URLs needed to perform operations from the ACME server.- Parameters:
account- the ACME account information to use (must not benull)staging- whether or not the staging server URL should be used- Returns:
- a map of ACME resources to URLs
- Throws:
AcmeException- if an error occurs while attempting to get the resource URLs from the ACME server
-
getMetadata
Get the metadata associated with the ACME server.- Parameters:
account- the ACME account information to use (must not benull)staging- whether or not the staging server URL should be used- Returns:
- the metadata associated with the ACME server (may be
null) - Throws:
AcmeException- if an error occurs while attempting to get the metadata associated with the ACME server
-
createAccount
Create an account with an ACME server using the given account information.- Parameters:
account- the ACME account information to use (must not benull)staging- whether or not the staging server URL should be used- Returns:
trueif the account was created,falseif the account already existed- Throws:
AcmeException- if an error occurs while attempting to create or lookup an account with the ACME server
-
createAccount
public boolean createAccount(AcmeAccount account, boolean staging, boolean onlyReturnExisting) throws AcmeException Create an account with an ACME server using the given account information.- Parameters:
account- the ACME account information to use (must not benull)staging- whether or not the staging server URL should be usedonlyReturnExisting-trueif the ACME server should not create a new account if one does not already exist (this allows an existing account's URL to be looked up and populated using the account key)- Returns:
trueif the account was created,falseif the account already existed- Throws:
AcmeException- if an error occurs while attempting to create or lookup an account with the ACME server or ifonlyReturnExistingis set totrueand the account does not exist
-
updateAccount
public void updateAccount(AcmeAccount account, boolean staging, boolean termsOfServiceAgreed) throws AcmeException Update whether or not the terms of service have been agreed to for an account with an ACME server.- Parameters:
account- the ACME account information to use (must not benull)staging- whether or not the staging server URL should be usedtermsOfServiceAgreed- the new value for whether or not the terms of service have been agreed to- Throws:
AcmeException- if an error occurs while attempting to update the account
-
updateAccount
public void updateAccount(AcmeAccount account, boolean staging, String[] contactUrls) throws AcmeException Update the contact URLs for an account with an ACME server.- Parameters:
account- the ACME account information to use (must not benull)staging- whether or not the staging server URL should be usedcontactUrls- the new account contact URLs- Throws:
AcmeException- if an error occurs while attempting to update the account
-
updateAccount
public void updateAccount(AcmeAccount account, boolean staging, boolean termsOfServiceAgreed, String[] contactUrls) throws AcmeException Update an account with an ACME server using the given account information.- Parameters:
account- the ACME account information to use (must not benull)staging- whether or not the staging server URL should be usedtermsOfServiceAgreed- the new value for whether or not the terms of service have been agreed tocontactUrls- the new account contact URLs- Throws:
AcmeException- if an error occurs while attempting to update the account
-
changeAccountKey
Change the key that is associated with the given ACME account.- Parameters:
account- the ACME account information to use (must not benull)staging- whether or not the staging server URL should be used- Throws:
AcmeException- if an error occurs while attempting to change the key that is associated with the given ACME account
-
changeAccountKey
public void changeAccountKey(AcmeAccount account, boolean staging, X509Certificate certificate, PrivateKey privateKey) throws AcmeException Change the key that is associated with the given ACME account.- Parameters:
account- the ACME account information to use (must not benull)staging- whether or not the staging server URL should be usedcertificate- the new certificate to associate with the given ACME account (must not benull)privateKey- the new private key to associate with the given ACME account (must not benull)- Throws:
AcmeException- if an error occurs while attempting to change the key that is associated with the given ACME account
-
deactivateAccount
Deactivate the given ACME account. It is not possible to reactivate an ACME account after it has been deactivated.- Parameters:
account- the ACME account information to use (must not benull)staging- whether or not the staging server URL should be used- Throws:
AcmeException- if an error occurs while attempting to deactivate the given ACME account
-
obtainCertificateChain
public X509CertificateChainAndSigningKey obtainCertificateChain(AcmeAccount account, boolean staging, String... domainNames) throws AcmeException Obtain a certificate chain using the given ACME account.- Parameters:
account- the ACME account information to use (must not benull)staging- whether or not the staging server URL should be useddomainNames- the domain names to request the certificate for (must not benull)- Returns:
- the X509 certificate chain and private key
- Throws:
AcmeException- if an occur occurs while attempting to obtain the certificate
-
obtainCertificateChain
public X509CertificateChainAndSigningKey obtainCertificateChain(AcmeAccount account, boolean staging, String keyAlgorithmName, int keySize, String... domainNames) throws AcmeException Obtain a certificate chain using the given ACME account.- Parameters:
account- the ACME account information to use (must not benull)staging- whether or not the staging server URL should be usedkeyAlgorithmName- the optional key algorithm name to use when generating the key pair (may benull)keySize- the optional key size to use when generating the key pair (-1 to indicate that the default key size should be used)domainNames- the domain names to request the certificate for (must not benull)- Returns:
- the X509 certificate chain and private key
- Throws:
AcmeException- if an occur occurs while attempting to obtain the certificate
-
createAuthorization
public String createAuthorization(AcmeAccount account, boolean staging, String domainName) throws AcmeException Create an authorization for the given identifier.This method allows an ACME client to obtain authorization for an identifier proactively before attempting to obtain a certificate.
- Parameters:
account- the ACME account information to use (must not benull)staging- whether or not the staging server URL should be useddomainName- the domain name to create an authorization for (must not benull)- Returns:
- the authorization URL corresponding to the given identifier
- Throws:
AcmeException- if an error occurs while attempting to create an authorization for the given identifier
-
deactivateAuthorization
public void deactivateAuthorization(AcmeAccount account, boolean staging, String authorizationUrl) throws AcmeException Deactivate an authorization.- Parameters:
account- the ACME account information to use (must not benull)staging- whether or not the staging server URL should be usedauthorizationUrl- the authorization url (must not benull)- Throws:
AcmeException- if an error occurs while attempting to deactivate an authorization for the given identifier
-
proveIdentifierControl
public abstract AcmeChallenge proveIdentifierControl(AcmeAccount account, List<AcmeChallenge> challenges) throws AcmeException Prove control of the identifier associated with the given list of challenges.This method should select one challenge from the given list of challenges from the ACME server to prove control of the identifier associated with the challenges as specified by the ACME v2 protocol.
- Parameters:
account- the ACME account information to use (must not benull)challenges- the list of challenges from the ACME server (must not benull)- Returns:
- the challenge that was selected and used to prove control of the identifier
- Throws:
AcmeException- if an error occurs while attempting to provide control of the identifier associated with the challenges or if none of the challenge types are supported by this client
-
cleanupAfterChallenge
public abstract void cleanupAfterChallenge(AcmeAccount account, AcmeChallenge challenge) throws AcmeException Undo the actions that were taken to prove control of the identifier associated with the given challenge.- Parameters:
account- the ACME account information to use (must not benull)challenge- the challenge (must not benull)- Throws:
AcmeException- if an error occurs while attempting to undo the actions that were taken to prove control of the identifier associated with the given challenge
-
revokeCertificate
public void revokeCertificate(AcmeAccount account, boolean staging, X509Certificate certificate) throws AcmeException Revoke the given certificate.- Parameters:
account- the ACME account information to use (must not benull)staging- whether or not the staging server URL should be usedcertificate- the certificate to be revoked (must not benull)- Throws:
AcmeException- if an error occurs while attempting to revoke the given certificate
-
revokeCertificate
public void revokeCertificate(AcmeAccount account, boolean staging, X509Certificate certificate, CRLReason reason) throws AcmeException Revoke the given certificate.- Parameters:
account- the ACME account information to use (must not benull)staging- whether or not the staging server URL should be usedcertificate- the certificate to be revoked (must not benull)reason- the optional reason why the certificate is being revoked (may benull)- Throws:
AcmeException- if an error occurs while attempting to revoke the given certificate
-
getNewNonce
Get a new nonce for the given account from the ACME server.- Parameters:
account- the ACME account information to use (must not benull)staging- whether or not the staging server URL should be used- Returns:
- nonce the new nonce for the given account
- Throws:
AcmeException- if an error occurs while attempting to get the new nonce from the ACME server
-