Search in sources :

Example 1 with CertificateIssuerExtension

use of org.mozilla.jss.netscape.security.x509.CertificateIssuerExtension in project jss by dogtagpki.

the class ExtPrettyPrint method getCertificateIssuerExtension.

/**
 * String Representation of CertificateIssuerExtension
 */
private String getCertificateIssuerExtension() {
    StringBuffer sb = new StringBuffer();
    try {
        sb.append(pp.indent(mIndentSize) + mResource.getString(PrettyPrintResources.TOKEN_IDENTIFIER));
        sb.append(mResource.getString(PrettyPrintResources.TOKEN_CERTIFICATE_ISSUER) + "- " + mExt.getExtensionId().toString() + "\n");
        sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_CRITICAL));
        CertificateIssuerExtension ext = (CertificateIssuerExtension) mExt;
        if (mExt.isCritical()) {
            sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n");
        } else {
            sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n");
        }
        GeneralNames issuerNames = (GeneralNames) ext.get(CertificateIssuerExtension.CERTIFICATE_ISSUER);
        if (issuerNames != null) {
            sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_ISSUER_NAMES) + "\n");
            for (int i = 0; i < issuerNames.size(); i++) {
                GeneralName issuerName = (GeneralName) issuerNames.elementAt(i);
                if (issuerName != null) {
                    String nameType = "";
                    if (issuerName.getType() == GeneralNameInterface.NAME_DIRECTORY)
                        nameType = "DirectoryName: ";
                    sb.append(pp.indent(mIndentSize + 8) + nameType + issuerName.toString() + "\n");
                }
            }
        }
        return sb.toString();
    } catch (IOException e) {
        e.printStackTrace();
        return "";
    }
}
Also used : GeneralNames(org.mozilla.jss.netscape.security.x509.GeneralNames) GeneralName(org.mozilla.jss.netscape.security.x509.GeneralName) IOException(java.io.IOException) CertificateIssuerExtension(org.mozilla.jss.netscape.security.x509.CertificateIssuerExtension) CRLDistributionPoint(org.mozilla.jss.netscape.security.x509.CRLDistributionPoint) IssuingDistributionPoint(org.mozilla.jss.netscape.security.x509.IssuingDistributionPoint)

Aggregations

IOException (java.io.IOException)1 CRLDistributionPoint (org.mozilla.jss.netscape.security.x509.CRLDistributionPoint)1 CertificateIssuerExtension (org.mozilla.jss.netscape.security.x509.CertificateIssuerExtension)1 GeneralName (org.mozilla.jss.netscape.security.x509.GeneralName)1 GeneralNames (org.mozilla.jss.netscape.security.x509.GeneralNames)1 IssuingDistributionPoint (org.mozilla.jss.netscape.security.x509.IssuingDistributionPoint)1