Example usage for com.itextpdf.text.pdf.security CertificateInfo getIssuerFields

List of usage examples for com.itextpdf.text.pdf.security CertificateInfo getIssuerFields

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf.security CertificateInfo getIssuerFields.

Prototype

public static X500Name getIssuerFields(X509Certificate cert) 

Source Link

Document

Get the issuer fields from an X509 Certificate

Usage

From source file:cz.hobrasoft.pdfmu.operation.OperationInspect.java

License:Open Source License

private CertificateResult showCertInfo(X509Certificate cert) {
    CertificateResult certRes = new CertificateResult();

    { // Self-signed?
        X500Principal principalSubject = cert.getSubjectX500Principal();
        X500Principal principalIssuer = cert.getIssuerX500Principal();
        boolean selfSigned = principalSubject.equals(principalIssuer);
        to.println(String.format("Self-signed: %s", (selfSigned ? "Yes" : "No")));
        certRes.selfSigned = selfSigned;
    }//from w  ww .  ja  v  a  2  s.  c  om

    // Note: More attributes may be available by more direct processing of `cert`
    // than by using `CertificateInfo.get*Fields`.
    { // Subject
        to.indentMore("Subject:");
        certRes.subject = showX500Name(CertificateInfo.getSubjectFields(cert));
        to.indentLess();
    }
    { // Issuer
        to.indentMore("Issuer:");
        certRes.issuer = showX500Name(CertificateInfo.getIssuerFields(cert));
        to.indentLess();
    }

    return certRes;
}