Session session = new Session(letsEncryptUrl);
public AcmeServiceImpl(LetsencryptConfig config) { this.config = config; try { LOGGER.info("Logging to {}", config.getUrl()); session = new Session(new URI(config.getUrl())); login(); } catch (Exception e) { throw new LetsencryptException("Problem connecting to ACME", e); } }
public CompletableFuture<AcmeInfo> fetchRemoteInfo() { try { Session session = new Session(config.getProviderLocation()); Metadata metadata = session.getMetadata(); URI termsOfServiceUri = metadata.getTermsOfService(); URL website = metadata.getWebsite(); return CompletableFuture.completedFuture(new AcmeInfo(termsOfServiceUri, website)); } catch(AcmeException e) { throw new RuntimeException(e); } }
public CompletableFuture<URL> openAccount(String email, KeyPair accountKeyPair) { try { log.info("open account"); Session session = new Session("acme://letsencrypt.org/staging"); Account account = new AccountBuilder() .addContact("mailto:"+email) .agreeToTermsOfService() .useKeyPair(accountKeyPair) .create(session); URL location = account.getLocation(); log.info("account location="+location); return CompletableFuture.completedFuture(location); } catch (AcmeException e) { throw new RuntimeException(e); } } //TODO: Put the remote request INTO a different pool to not hold up the webserver main
private Registration loadOrCreateRegistration() { KeyPair userKeyPair; try { userKeyPair = loadOrCreateKeyPair(new File(basepath, "user.key")); } catch (IOException e) { String message = "unable to load user keypair"; messages.add(message); LOG.error(message, e); return null; } messages.add("creating session", LOG); Session session = new Session(config.getProperty("acme.ca.url"), userKeyPair); Registration reg; try { reg = loadOrRegisterAccount(session); } catch (AcmeException e) { String message = "unable to setup account"; messages.add(message); LOG.error(message, e); return null; } return reg; }
/** * @return The list of challenges with tokens to create webpages for that remote end will call to verify we own the domain */ public CompletableFuture<ProxyOrder> placeOrder(URL accountUrl, KeyPair accountKeyPair) { try { log.info("reestablish account from location="+accountUrl+" and keypair"); Session session = new Session("acme://letsencrypt.org/staging"); Login login = session.login(accountUrl, accountKeyPair); Account account = login.getAccount(); log.info("create an order"); String domainTemp = "something.com"; Order order = account.newOrder() .domain(domainTemp) .create(); checkAuthStatii(order); List<ProxyAuthorization> auths = new ArrayList<>(); for(Authorization auth : order.getAuthorizations()) auths.add(new ProxyAuthorization(auth)); return CompletableFuture.completedFuture(new ProxyOrder(order, auths)); } catch (AcmeException e) { throw new RuntimeException(e); } }
Session session = new Session(config.getEndpoint(), userKeyPair);
Session session = new Session("acme://letsencrypt.org/staging");
final KeyPair domainKeyPair = loadOrCreateKeyPair(config.getDomainKeySize(), config.getDomainKey()); final Session session = new Session(config.getEndpoint()); try { final Account account = new AccountBuilder().agreeToTermsOfService().useKeyPair(userKeyPair).create(session);