use of org.openecard.bouncycastle.util.io.pem.PemObject in project open-ecard by ecsec.
the class SmartCardCredentialFactory method printCerts.
private void printCerts(List<DidInfo> infos) {
for (DidInfo next : infos) {
try {
List<X509Certificate> chain = next.getRelatedCertificateChain();
if (LOG.isDebugEnabled()) {
for (X509Certificate cert : chain) {
StringWriter out = new StringWriter();
PemWriter pw = new PemWriter(out);
pw.writeObject(new PemObject("CERTIFICATE", cert.getEncoded()));
pw.close();
LOG.debug("Certificate for DID {}\n{}", next.getDidName(), out);
LOG.debug("Certificate details\n{}", cert);
}
}
} catch (SecurityConditionUnsatisfiable | NoSuchDid | CertificateException | IOException ex) {
LOG.error("Failed to read certificates from card. Skipping DID " + next.getDidName() + ".", ex);
} catch (WSHelper.WSException ex) {
LOG.error("Unknown error accessing DID " + next.getDidName() + ".", ex);
}
}
}
Aggregations