public void index(TrustAnchor anchor) { X500Principal subject; X509Certificate cert = anchor.getTrustedCert(); if (cert != null) { subject = cert.getSubjectX500Principal(); } else { subject = anchor.getCA(); } synchronized (subjectToTrustAnchors) { List<TrustAnchor> anchors = subjectToTrustAnchors.get(subject); if (anchors == null) { anchors = new ArrayList<TrustAnchor>(1); subjectToTrustAnchors.put(subject, anchors); } anchors.add(anchor); } }
/** * Log information from the constructed cert path at level debug. * * @param buildResult the PKIX cert path builder result containing the cert path and trust anchor * @param targetCert the cert untrusted certificate that was being evaluated */ private void logCertPathDebug(PKIXCertPathBuilderResult buildResult, X509Certificate targetCert) { log.debug("Built valid PKIX cert path"); log.debug("Target certificate: {}", x500DNHandler.getName(targetCert.getSubjectX500Principal())); for (Certificate cert : buildResult.getCertPath().getCertificates()) { log.debug("CertPath certificate: {}", x500DNHandler.getName(((X509Certificate) cert) .getSubjectX500Principal())); } TrustAnchor ta = buildResult.getTrustAnchor(); if (ta.getTrustedCert() != null) { log.debug("TrustAnchor: {}", x500DNHandler.getName(ta.getTrustedCert().getSubjectX500Principal())); } else if (ta.getCA() != null) { log.debug("TrustAnchor: {}", x500DNHandler.getName(ta.getCA())); } else { log.debug("TrustAnchor: {}", ta.getCAName()); } }
/** * Log information from the constructed cert path at level debug. * * @param buildResult the PKIX cert path builder result containing the cert path and trust anchor * @param targetCert the cert untrusted certificate that was being evaluated */ private void logCertPathDebug(PKIXCertPathBuilderResult buildResult, X509Certificate targetCert) { log.debug("Built valid PKIX cert path"); log.debug("Target certificate: {}", x500DNHandler.getName(targetCert.getSubjectX500Principal())); for (Certificate cert : buildResult.getCertPath().getCertificates()) { log.debug("CertPath certificate: {}", x500DNHandler.getName(((X509Certificate) cert) .getSubjectX500Principal())); } TrustAnchor ta = buildResult.getTrustAnchor(); if (ta.getTrustedCert() != null) { log.debug("TrustAnchor: {}", x500DNHandler.getName(ta.getTrustedCert().getSubjectX500Principal())); } else if (ta.getCA() != null) { log.debug("TrustAnchor: {}", x500DNHandler.getName(ta.getCA())); } else { log.debug("TrustAnchor: {}", ta.getCAName()); } }
public void index(TrustAnchor anchor) { X500Principal subject; X509Certificate cert = anchor.getTrustedCert(); if (cert != null) { subject = cert.getSubjectX500Principal(); } else { subject = anchor.getCA(); } synchronized (subjectToTrustAnchors) { List<TrustAnchor> anchors = subjectToTrustAnchors.get(subject); if (anchors == null) { anchors = new ArrayList<TrustAnchor>(1); subjectToTrustAnchors.put(subject, anchors); } anchors.add(anchor); } }
/** * Log information from the constructed cert path at level debug. * * @param buildResult the PKIX cert path builder result containing the cert path and trust anchor * @param targetCert the cert untrusted certificate that was being evaluated */ private void logCertPathDebug(PKIXCertPathBuilderResult buildResult, X509Certificate targetCert) { log.debug("Built valid PKIX cert path"); log.debug("Target certificate: {}", getX500DNHandler().getName(targetCert.getSubjectX500Principal())); for (Certificate cert : buildResult.getCertPath().getCertificates()) { log.debug("CertPath certificate: {}", getX500DNHandler().getName(((X509Certificate) cert) .getSubjectX500Principal())); } TrustAnchor ta = buildResult.getTrustAnchor(); if (ta.getTrustedCert() != null) { log.debug("TrustAnchor: {}", getX500DNHandler().getName(ta.getTrustedCert().getSubjectX500Principal())); } else if (ta.getCA() != null) { log.debug("TrustAnchor: {}", getX500DNHandler().getName(ta.getCA())); } else { log.debug("TrustAnchor: {}", ta.getCAName()); } }
static X500Name getCA(TrustAnchor trustAnchor) { return X500Name.getInstance(trustAnchor.getCA().getEncoded()); }
static X500Name getCA(TrustAnchor trustAnchor) { return X500Name.getInstance(trustAnchor.getCA().getEncoded()); }
static X500Name getCA(TrustAnchor trustAnchor) { return X500Name.getInstance(trustAnchor.getCA().getEncoded()); }
static X500Name getCA(TrustAnchor trustAnchor) { return X500Name.getInstance(trustAnchor.getCA().getEncoded()); }
public void index(TrustAnchor anchor) { X500Principal subject; X509Certificate cert = anchor.getTrustedCert(); if (cert != null) { subject = cert.getSubjectX500Principal(); } else { subject = anchor.getCA(); } synchronized (subjectToTrustAnchors) { List<TrustAnchor> anchors = subjectToTrustAnchors.get(subject); if (anchors == null) { anchors = new ArrayList<TrustAnchor>(1); subjectToTrustAnchors.put(subject, anchors); } else { // Avoid indexing the same certificate multiple times if (cert != null) { for (TrustAnchor entry : anchors) { if (cert.equals(entry.getTrustedCert())) { return; } } } } anchors.add(anchor); } }
public void index(TrustAnchor anchor) { X500Principal subject; X509Certificate cert = anchor.getTrustedCert(); if (cert != null) { subject = cert.getSubjectX500Principal(); } else { subject = anchor.getCA(); } synchronized (subjectToTrustAnchors) { List<TrustAnchor> anchors = subjectToTrustAnchors.get(subject); if (anchors == null) { anchors = new ArrayList<TrustAnchor>(1); subjectToTrustAnchors.put(subject, anchors); } else { // Avoid indexing the same certificate multiple times if (cert != null) { for (TrustAnchor entry : anchors) { if (cert.equals(entry.getTrustedCert())) { return; } } } } anchors.add(anchor); } }