certificate.writeCertificate(fw); log.info("Overriding certificate. Expiration date is : {}", certificate.getCertificate().getNotAfter());
LOG.info("Certificate URL: {}", certificate.getLocation()); certificate.writeCertificate(fw);
logger.info("Certificate URL: {}", certificate.getLocation()); X509Certificate cert = certificate.download(); X509Certificate[] chain = certificate.downloadChain();
/** * Downloads the certificate chain. * <p> * The certificate is downloaded lazily by the other methods. So usually there is no * need to invoke this method, unless the download is to be enforced. If the * certificate has been downloaded already, nothing will happen. * * @throws AcmeException * if the certificate could not be downloaded */ public void download() throws AcmeException { if (certChain == null) { LOG.debug("download"); try (Connection conn = getSession().connect()) { conn.sendCertificateRequest(getLocation(), getLogin()); alternates = new ArrayList<>(conn.getLinks("alternate")); certChain = new ArrayList<>(conn.readCertificates()); } } }
/** * Revokes this certificate. * * @param reason * {@link RevocationReason} stating the reason of the revocation that is * used when generating OCSP responses and CRLs. {@code null} to give no * reason. */ public void revoke(@Nullable RevocationReason reason) throws AcmeException { revoke(getLogin(), getCertificate(), reason); }
X509Certificate cert; try { cert = certificate.download(); } catch (AcmeException e) { String message = "unable to download certificate"; X509Certificate[] chain; try { chain = certificate.downloadChain(); } catch (AcmeException e) { String message = "unable to download certificate chain";
/** * Lazily downloads the certificate. Throws a runtime {@link AcmeLazyLoadingException} * if the download failed. */ private void lazyDownload() { try { download(); } catch (AcmeException ex) { throw new AcmeLazyLoadingException(this, ex); } }
/** * Writes the certificate to the given writer. It is written in PEM format, with the * end-entity cert coming first, followed by the intermediate ceritificates. * * @param out * {@link Writer} to write to. The writer is not closed after use. */ public void writeCertificate(@WillNotClose Writer out) throws IOException { try { for (X509Certificate cert : getCertificateChain()) { AcmeUtils.writeToPem(cert.getEncoded(), AcmeUtils.PemLabel.CERTIFICATE, out); } } catch (CertificateEncodingException ex) { throw new IOException("Encoding error", ex); } }
X509Certificate cert = certificate.getCertificate(); return new RSACertificate(cert);
/** * Creates a new instance of {@link Certificate} and binds it to this login. * * @param location * Location of the Certificate * @return {@link Certificate} bound to the login */ public Certificate bindCertificate(URL location) { return new Certificate(this, requireNonNull(location, "location")); }
getLogger().info("Got new certificate " + certificate.getLocation() + " for domain(s) " + config.getDomains()); certificate.writeCertificate(writer);
/** * Downloads the certificate chain. * <p> * The certificate is downloaded lazily by the other methods. So usually there is no * need to invoke this method, unless the download is to be enforced. If the * certificate has been downloaded already, nothing will happen. * * @throws AcmeException * if the certificate could not be downloaded */ public void download() throws AcmeException { if (certChain == null) { LOG.debug("download"); try (Connection conn = getSession().connect()) { conn.sendCertificateRequest(getLocation(), getLogin()); alternates = new ArrayList<>(conn.getLinks("alternate")); certChain = new ArrayList<>(conn.readCertificates()); } } }
/** * Revokes this certificate. * * @param reason * {@link RevocationReason} stating the reason of the revocation that is * used when generating OCSP responses and CRLs. {@code null} to give no * reason. */ public void revoke(@Nullable RevocationReason reason) throws AcmeException { revoke(getLogin(), getCertificate(), reason); }
/** * Lazily downloads the certificate. Throws a runtime {@link AcmeLazyLoadingException} * if the download failed. */ private void lazyDownload() { try { download(); } catch (AcmeException ex) { throw new AcmeLazyLoadingException(this, ex); } }
/** * Writes the certificate to the given writer. It is written in PEM format, with the * end-entity cert coming first, followed by the intermediate ceritificates. * * @param out * {@link Writer} to write to. The writer is not closed after use. */ public void writeCertificate(@WillNotClose Writer out) throws IOException { try { for (X509Certificate cert : getCertificateChain()) { AcmeUtils.writeToPem(cert.getEncoded(), AcmeUtils.PemLabel.CERTIFICATE, out); } } catch (CertificateEncodingException ex) { throw new IOException("Encoding error", ex); } }
/** * Creates a new instance of {@link Certificate} and binds it to this login. * * @param location * Location of the Certificate * @return {@link Certificate} bound to the login */ public Certificate bindCertificate(URL location) { return new Certificate(this, requireNonNull(location, "location")); }
return CompletableFuture.completedFuture(new CertAndSigningRequest(writer.toString(), cert.getCertificateChain())); } catch (IOException e) { throw new RuntimeException(e);