private static String getSanitizedDomainName(String domainName) throws AcmeException { if (domainName == null) { throw acme.domainNameIsNull(); } domainName = IDN.toASCII(domainName.trim()); return domainName.toLowerCase(Locale.ROOT); }
private static LinkedHashSet<String> getDomainNames(String[] domainNames) throws AcmeException { if (domainNames.length == 0) { throw acme.domainNamesIsEmpty(); } final LinkedHashSet<String> domainNamesSet = new LinkedHashSet<>(); for (String domainName : domainNames) { domainNamesSet.add(getSanitizedDomainName(domainName)); } return domainNamesSet; }
private static String getLocation(HttpURLConnection connection) throws AcmeException { String location = connection.getHeaderField(LOCATION); if (location == null) { throw acme.noAccountLocationUrlProvidedByAcmeServer(); } return location; }
throw log.noAcmeServerUrlGiven(); throw acme.unableToDetermineKeySize(); throw log.unableToDetermineDefaultCompatibleSignatureAlgorithmName(privateKey.getAlgorithm()); signatureAlgorithm = getDefaultCompatibleSignatureAlgorithmName(privateKey); if (signatureAlgorithm == null) { throw log.unableToDetermineDefaultCompatibleSignatureAlgorithmName(privateKey.getAlgorithm()); throw acme.acmeAccountKeyPairGenerationFailed(e);
jsonResponse = pollResourceUntilFinalized(account, staging, authorizationUrl); if (! jsonResponse.getString(STATUS).equals(VALID)) { throw acme.challengeResponseFailedValidationByAcmeServer(); throw acme.noCertificateWillBeIssuedByAcmeServer(); throw acme.noCertificateUrlProvidedByAcmeServer();
String contentType = connection.getContentType(); if (! checkContentType(connection, expectedContentType)) { throw acme.unexpectedContentTypeFromAcmeServer(contentType); throw acme.badAcmeNonce(); // max attempts reached } catch (Exception e) { if (e instanceof AcmeException) {
private String getAccountUrl(AcmeAccount account, boolean staging) throws AcmeException { String accountUrl = account.getAccountUrl(); if (accountUrl == null) { createAccount(account, staging, true); accountUrl = account.getAccountUrl(); if (accountUrl == null) { acme.acmeAccountDoesNotExist(); } } return accountUrl; }
private static void skipDelims(CodePointIterator di, CodePointIterator cpi, int...delims) throws AcmeException { while ((! di.hasNext()) && cpi.hasNext()) { if (! isDelim(cpi.next(), delims)) { throw acme.invalidContentTypeFromAcmeServer(); } } }
jsonResponse = pollResourceUntilFinalized(account, staging, authorizationUrl); if (! jsonResponse.getString(STATUS).equals(VALID)) { throw acme.challengeResponseFailedValidationByAcmeServer();