First check the configuration constants at the top of the class. Then run the class, and pass in the names of the domains as parameters.
The tool won't run as-is. You MUST change the CA_URI
constant and set the
connection URI of your target CA there.
If your CA requires External Account Binding (EAB), you MUST also fill the
EAB_KID
and EAB_HMAC
constants with the values provided by your CA.
If your CA requires an email field to be set in your account, you also need to set
ACCOUNT_EMAIL
.
All other fields are optional and should work with the default values, unless your CA has special requirements (e.g. to the key type).
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
acceptAgreement
(URI agreement) Presents the user a link to the Terms of Service, and asks for confirmation.void
acceptChallenge
(String message) Presents the instructions for preparing the challenge validation, and waits for dismissal.void
completeChallenge
(String message) Presents the instructions for removing the challenge validation, and waits for dismissal.dnsChallenge
(Authorization auth) Prepares a DNS challenge.void
fetchCertificate
(Collection<String> domains) Generates a certificate for the given domains.httpChallenge
(Authorization auth) Prepares a HTTP challenge.static void
Invokes this example.
-
Constructor Details
-
ClientTest
public ClientTest()
-
-
Method Details
-
fetchCertificate
Generates a certificate for the given domains. Also takes care for the registration process.- Parameters:
domains
- Domains to get a common certificate for- Throws:
IOException
AcmeException
-
httpChallenge
Prepares a HTTP challenge.The verification of this challenge expects a file with a certain content to be reachable at a given path under the domain to be tested.
This example outputs instructions that need to be executed manually. In a production environment, you would rather generate this file automatically, or maybe use a servlet that returns
TokenChallenge.getAuthorization()
.- Parameters:
auth
-Authorization
to find the challenge in- Returns:
Challenge
to verify- Throws:
AcmeException
-
dnsChallenge
Prepares a DNS challenge.The verification of this challenge expects a TXT record with a certain content.
This example outputs instructions that need to be executed manually. In a production environment, you would rather configure your DNS automatically.
- Parameters:
auth
-Authorization
to find the challenge in- Returns:
Challenge
to verify- Throws:
AcmeException
-
acceptChallenge
Presents the instructions for preparing the challenge validation, and waits for dismissal. If the user cancelled the dialog, an exception is thrown.- Parameters:
message
- Instructions to be shown in the dialog- Throws:
AcmeException
-
completeChallenge
Presents the instructions for removing the challenge validation, and waits for dismissal.- Parameters:
message
- Instructions to be shown in the dialog
-
acceptAgreement
Presents the user a link to the Terms of Service, and asks for confirmation. If the user denies confirmation, an exception is thrown.- Parameters:
agreement
-URI
of the Terms of Service- Throws:
AcmeException
-
main
Invokes this example.- Parameters:
args
- Domains to get a certificate for
-