shred / acme4j

Java client for ACME (Let's Encrypt)
https://acme4j.shredzone.org
Apache License 2.0
520 stars 96 forks source link

Provide example showing how to save and load existing certificates #153

Closed cowwoc closed 8 months ago

cowwoc commented 9 months ago

Given that most (all?) ACME servers do not support listing existing certifications, please clarify how we are supposed to create a Certificate object without placing an Order with the ACME server.

We need to know what information needs to be saved, and how to use this information to construct a Certificate at a later time.

shred commented 9 months ago

Please see the answer I gave in issue 146: https://github.com/shred/acme4j/issues/146#issuecomment-1815934037

You need to store the certificate location somewhere.

Certificate cert = // the certificate that was freshly created
URL certLocation = cert.getLocation();
// store certLocation somewhere

To reconstruct the Certificate instance from that location, bind it to a Login:

Login login = // your login
URL certLocation = // certLocation that was stored

Certificate cert = login.bindCertificate(certLocation);
cowwoc commented 8 months ago

Works for me. Thank you.