java.lang.Object
org.shredzone.acme4j.example.ClientTest

public class ClientTest extends Object
A simple client test tool.

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).

See Also:
  • Constructor Details

  • 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

      public void acceptChallenge(String message) throws AcmeException
      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

      public void completeChallenge(String message)
      Presents the instructions for removing the challenge validation, and waits for dismissal.
      Parameters:
      message - Instructions to be shown in the dialog
    • acceptAgreement

      public void acceptAgreement(URI agreement) throws AcmeException
      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

      public static void main(String... args)
      Invokes this example.
      Parameters:
      args - Domains to get a certificate for