Example usage for java.security.cert X509Certificate getSigAlgName

List of usage examples for java.security.cert X509Certificate getSigAlgName

Introduction

In this page you can find the example usage for java.security.cert X509Certificate getSigAlgName.

Prototype

public abstract String getSigAlgName();

Source Link

Document

Gets the signature algorithm name for the certificate signature algorithm.

Usage

From source file:org.ovirt.engine.core.utils.ssl.AuthSSLX509TrustManager.java

/**
 * @see javax.net.ssl.X509TrustManager#checkClientTrusted(X509Certificate[], String authType)
 *///  www  .  ja v  a2s . c om
public void checkClientTrusted(X509Certificate[] certificates, String authType) throws CertificateException {
    if (LOG.isDebugEnabled() && certificates != null) {
        for (int c = 0; c < certificates.length; c++) {
            X509Certificate cert = certificates[c];
            LOG.debug(" Client certificate " + (c + 1) + ":");
            LOG.debug("  Subject DN: " + cert.getSubjectDN());
            LOG.debug("  Signature Algorithm: " + cert.getSigAlgName());
            LOG.debug("  Valid from: " + cert.getNotBefore());
            LOG.debug("  Valid until: " + cert.getNotAfter());
            LOG.debug("  Issuer: " + cert.getIssuerDN());
        }
    }
    defaultTrustManager.checkClientTrusted(certificates, authType);
}

From source file:org.ovirt.engine.core.utils.ssl.AuthSSLX509TrustManager.java

/**
 * @see javax.net.ssl.X509TrustManager#checkServerTrusted(X509Certificate[], String authType)
 *//*from  w w w .j  a  v a  2 s .  co m*/
public void checkServerTrusted(X509Certificate[] certificates, String authType) throws CertificateException {
    if (LOG.isDebugEnabled() && certificates != null) {
        for (int c = 0; c < certificates.length; c++) {
            X509Certificate cert = certificates[c];
            LOG.debug(" Server certificate " + (c + 1) + ":");
            LOG.debug("  Subject DN: " + cert.getSubjectDN());
            LOG.debug("  Signature Algorithm: " + cert.getSigAlgName());
            LOG.debug("  Valid from: " + cert.getNotBefore());
            LOG.debug("  Valid until: " + cert.getNotAfter());
            LOG.debug("  Issuer: " + cert.getIssuerDN());
        }
    }
    defaultTrustManager.checkServerTrusted(certificates, authType);
}

From source file:io.cloudslang.content.mail.sslconfig.AuthSSLX509TrustManager.java

/**
 * @see javax.net.ssl.X509TrustManager#checkServerTrusted(java.security.cert.X509Certificate[], String authType)
 *//*from   w w w  .  j av a2s  .c om*/
public void checkServerTrusted(X509Certificate[] certificates, String authType) throws CertificateException {
    if (LOG.isInfoEnabled() && certificates != null) {
        for (int c = 0; c < certificates.length; c++) {
            X509Certificate cert = certificates[c];
            LOG.info(" Server certificate " + (c + 1) + ":");
            LOG.info("  Subject DN: " + cert.getSubjectDN());
            LOG.info("  Signature Algorithm: " + cert.getSigAlgName());
            LOG.info("  Valid from: " + cert.getNotBefore());
            LOG.info("  Valid until: " + cert.getNotAfter());
            LOG.info("  Issuer: " + cert.getIssuerDN());
            LOG.info("  SN: " + cert.getSerialNumber().toString(16));
        }
    }
    defaultTrustManager.checkServerTrusted(certificates, authType);
}

From source file:org.openhealthtools.openatna.net.LoggedX509TrustManager.java

/**
 * @see javax.net.ssl.X509TrustManager#checkClientTrusted(X509Certificate[], String)
 *///  w  w  w .  jav  a  2s . c  o  m
public void checkClientTrusted(X509Certificate[] certificates, String authType) throws CertificateException {
    if (log.isInfoEnabled() && certificates != null) {
        String s = "\n========== checking client certificate chain ==========";
        for (int c = 0; c < certificates.length; c++) {
            X509Certificate cert = certificates[c];
            s += "\n Client certificate " + (c + 1) + ":";
            s += "\n  Subject DN: " + cert.getSubjectDN();
            s += "\n  Signature Algorithm: " + cert.getSigAlgName();
            s += "\n  Valid from: " + cert.getNotBefore();
            s += "\n  Valid until: " + cert.getNotAfter();
            s += "\n  Issuer: " + cert.getIssuerDN();
        }
        s += "\n=======================================================";
        log.info(s);
    }
    // This will throw a CertificateException if it is not trusted.
    try {
        this.defaultTrustManager.checkClientTrusted(certificates, authType);
    } catch (CertificateException e) {
        log.error("Something wrong with the client certificate (auth type: \" + authType +\")", e);
        throw e;
    }
}

From source file:gov.va.med.imaging.proxy.ssl.AuthSSLX509TrustManager.java

/**
 * @see javax.net.ssl.X509TrustManager#checkClientTrusted(X509Certificate[],String authType)
 *//*  w  w w .j a v  a  2s  . c om*/
public void checkClientTrusted(X509Certificate[] certificates, String authType) throws CertificateException {
    if (LOG.isInfoEnabled() && certificates != null) {
        for (int c = 0; c < certificates.length; c++) {
            X509Certificate cert = certificates[c];
            LOG.debug(" Client certificate " + (c + 1) + ":");
            LOG.debug("  Subject DN: " + cert.getSubjectDN());
            LOG.debug("  Signature Algorithm: " + cert.getSigAlgName());
            LOG.debug("  Valid from: " + cert.getNotBefore());
            LOG.debug("  Valid until: " + cert.getNotAfter());
            LOG.debug("  Issuer: " + cert.getIssuerDN());
        }
    }
    defaultTrustManager.checkClientTrusted(certificates, authType);
}

From source file:gov.va.med.imaging.proxy.ssl.AuthSSLX509TrustManager.java

/**
 * @see javax.net.ssl.X509TrustManager#checkServerTrusted(X509Certificate[],String authType)
 *//* ww  w  .  j  av a 2s  .co m*/
public void checkServerTrusted(X509Certificate[] certificates, String authType) throws CertificateException {
    if (LOG.isInfoEnabled() && certificates != null) {
        for (int c = 0; c < certificates.length; c++) {
            X509Certificate cert = certificates[c];
            LOG.debug(" Server certificate " + (c + 1) + ":");
            LOG.debug("  Subject DN: " + cert.getSubjectDN());
            LOG.debug("  Signature Algorithm: " + cert.getSigAlgName());
            LOG.debug("  Valid from: " + cert.getNotBefore());
            LOG.debug("  Valid until: " + cert.getNotAfter());
            LOG.debug("  Issuer: " + cert.getIssuerDN());
        }
    }
    defaultTrustManager.checkServerTrusted(certificates, authType);
}

From source file:com.thoughtworks.go.security.AuthSSLKeyManagerFactory.java

private void logKeyStore(KeyStore store) throws KeyStoreException {
    LOG.trace("Certificates count: " + store.size());
    Enumeration aliases = store.aliases();
    while (aliases.hasMoreElements()) {
        String alias = (String) aliases.nextElement();
        Certificate[] certs = store.getCertificateChain(alias);
        if (certs != null) {
            LOG.debug("Certificate chain '" + alias + "':");
            for (int c = 0; c < certs.length; c++) {
                if (certs[c] instanceof X509Certificate) {
                    X509Certificate cert = (X509Certificate) certs[c];
                    LOG.trace(" Certificate " + (c + 1) + ":");
                    LOG.trace("  Subject DN: " + cert.getSubjectDN());
                    LOG.trace("  Signature Algorithm: " + cert.getSigAlgName());
                    LOG.trace("  Valid from: " + cert.getNotBefore());
                    LOG.trace("  Valid until: " + cert.getNotAfter());
                    LOG.trace("  Issuer: " + cert.getIssuerDN());
                }/*from   w ww . j  a  v a2 s  .  com*/
            }
        }
    }
}

From source file:com.thoughtworks.go.security.SelfSignedCertificateX509TrustManager.java

/**
 * @see javax.net.ssl.X509TrustManager#checkClientTrusted(X509Certificate[],String authType)
 *//*from  ww w  . jav  a 2 s  .co  m*/
public void checkClientTrusted(X509Certificate[] certificates, String authType) throws CertificateException {
    if (LOG.isDebugEnabled() && certificates != null) {
        for (int c = 0; c < certificates.length; c++) {
            X509Certificate cert = certificates[c];
            LOG.info(" Client certificate " + (c + 1) + ":");
            LOG.info("  Subject DN: " + cert.getSubjectDN());
            LOG.info("  Signature Algorithm: " + cert.getSigAlgName());
            LOG.info("  Valid from: " + cert.getNotBefore());
            LOG.info("  Valid until: " + cert.getNotAfter());
            LOG.info("  Issuer: " + cert.getIssuerDN());
        }
    }
    defaultTrustManager.checkClientTrusted(certificates, authType);
}

From source file:com.thoughtworks.go.security.SelfSignedCertificateX509TrustManager.java

/**
 * @see javax.net.ssl.X509TrustManager#checkServerTrusted(X509Certificate[],String authType)
 *///from w  w w .j av a  2 s . c o  m
public void checkServerTrusted(X509Certificate[] certificates, String authType) throws CertificateException {
    if (LOG.isDebugEnabled() && certificates != null) {
        for (int c = 0; c < certificates.length; c++) {
            X509Certificate cert = certificates[c];
            LOG.info(" Server certificate " + (c + 1) + ":");
            LOG.info("  Subject DN: " + cert.getSubjectDN());
            LOG.info("  Signature Algorithm: " + cert.getSigAlgName());
            LOG.info("  Valid from: " + cert.getNotBefore());
            LOG.info("  Valid until: " + cert.getNotAfter());
            LOG.info("  Issuer: " + cert.getIssuerDN());
        }
    }

    try {
        if ((certificates != null) && (certificates.length == 1) && !truststore.containsAlias(CRUISE_SERVER)) {
            certificates[0].checkValidity();
            updateKeystore(CRUISE_SERVER, certificates[0]);
        } else {
            defaultTrustManager.checkServerTrusted(certificates, authType);
        }
    } catch (KeyStoreException ke) {
        throw new RuntimeException("Couldn't access keystore while checking server's certificate", ke);
    }
}

From source file:com.archivas.clienttools.arcutils.utils.net.SSLCertChain.java

public String getSignatureAlgorithm() {
    X509Certificate cert = getCertificateList().get(0);
    return cert.getSigAlgName();
}