Search in sources :

Example 1 with CertificateInstaller

use of lucee.runtime.net.http.CertificateInstaller in project Lucee by lucee.

the class Admin method getSSLCertificate.

public static Query getSSLCertificate(Config config, String host, int port) throws PageException {
    Resource cacerts = config.getSecurityDirectory();
    CertificateInstaller installer;
    try {
        installer = new CertificateInstaller(cacerts, host, port);
    } catch (Exception e) {
        throw Caster.toPageException(e);
    }
    X509Certificate[] certs = installer.getCertificates();
    X509Certificate cert;
    Query qry = new QueryImpl(new String[] { "subject", "issuer" }, certs.length, "certificates");
    for (int i = 0; i < certs.length; i++) {
        cert = certs[i];
        qry.setAtEL("subject", i + 1, cert.getSubjectDN().getName());
        qry.setAtEL("issuer", i + 1, cert.getIssuerDN().getName());
    }
    return qry;
}
Also used : QueryImpl(lucee.runtime.type.QueryImpl) Query(lucee.runtime.type.Query) Resource(lucee.commons.io.res.Resource) PageException(lucee.runtime.exp.PageException) SecurityException(lucee.runtime.exp.SecurityException) IOException(java.io.IOException) DeprecatedException(lucee.runtime.exp.DeprecatedException) BundleException(org.osgi.framework.BundleException) MalformedURLException(java.net.MalformedURLException) SMTPException(lucee.runtime.net.mail.SMTPException) ApplicationException(lucee.runtime.exp.ApplicationException) X509Certificate(java.security.cert.X509Certificate) CertificateInstaller(lucee.runtime.net.http.CertificateInstaller)

Example 2 with CertificateInstaller

use of lucee.runtime.net.http.CertificateInstaller in project Lucee by lucee.

the class Admin method updateSSLCertificate.

public static void updateSSLCertificate(Config config, String host, int port) throws PageException {
    Resource cacerts = config.getSecurityDirectory();
    try {
        CertificateInstaller installer = new CertificateInstaller(cacerts, host, port);
        installer.installAll();
    } catch (Exception e) {
        throw Caster.toPageException(e);
    }
}
Also used : Resource(lucee.commons.io.res.Resource) PageException(lucee.runtime.exp.PageException) SecurityException(lucee.runtime.exp.SecurityException) IOException(java.io.IOException) DeprecatedException(lucee.runtime.exp.DeprecatedException) BundleException(org.osgi.framework.BundleException) MalformedURLException(java.net.MalformedURLException) SMTPException(lucee.runtime.net.mail.SMTPException) ApplicationException(lucee.runtime.exp.ApplicationException) CertificateInstaller(lucee.runtime.net.http.CertificateInstaller)

Aggregations

IOException (java.io.IOException)2 MalformedURLException (java.net.MalformedURLException)2 Resource (lucee.commons.io.res.Resource)2 ApplicationException (lucee.runtime.exp.ApplicationException)2 DeprecatedException (lucee.runtime.exp.DeprecatedException)2 PageException (lucee.runtime.exp.PageException)2 SecurityException (lucee.runtime.exp.SecurityException)2 CertificateInstaller (lucee.runtime.net.http.CertificateInstaller)2 SMTPException (lucee.runtime.net.mail.SMTPException)2 BundleException (org.osgi.framework.BundleException)2 X509Certificate (java.security.cert.X509Certificate)1 Query (lucee.runtime.type.Query)1 QueryImpl (lucee.runtime.type.QueryImpl)1