diff options
author | alee <alee@c9f7a03b-bd48-0410-a16d-cbbf54688b0b> | 2008-08-14 19:01:40 +0000 |
---|---|---|
committer | alee <alee@c9f7a03b-bd48-0410-a16d-cbbf54688b0b> | 2008-08-14 19:01:40 +0000 |
commit | 78bdeb25861c9fd66457b73eecf7274913f271cb (patch) | |
tree | 2fb2952edc5a48179b46afb380d0c034806702e5 /pki/base/util | |
parent | 4bb94b38ec0ddf48b2f9c12bebe65c1b2116da0d (diff) | |
download | pki-78bdeb25861c9fd66457b73eecf7274913f271cb.tar.gz pki-78bdeb25861c9fd66457b73eecf7274913f271cb.tar.xz pki-78bdeb25861c9fd66457b73eecf7274913f271cb.zip |
Fix for bug #458317: certitificate policy extensions not displayed in PrettyPrintCert
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/pki/trunk@110 c9f7a03b-bd48-0410-a16d-cbbf54688b0b
Diffstat (limited to 'pki/base/util')
-rw-r--r-- | pki/base/util/src/netscape/security/util/ExtPrettyPrint.java | 42 | ||||
-rw-r--r-- | pki/base/util/src/netscape/security/x509/DisplayText.java | 15 |
2 files changed, 54 insertions, 3 deletions
diff --git a/pki/base/util/src/netscape/security/util/ExtPrettyPrint.java b/pki/base/util/src/netscape/security/util/ExtPrettyPrint.java index 8db38c7a1..1efe1db4b 100644 --- a/pki/base/util/src/netscape/security/util/ExtPrettyPrint.java +++ b/pki/base/util/src/netscape/security/util/ExtPrettyPrint.java @@ -1534,15 +1534,51 @@ public class ExtPrettyPrint { } sb.append(pp.indent(mIndentSize + 4) + mResource.getString( PrettyPrintResources.TOKEN_CERT_POLICIES) + "\n"); - CertificatePoliciesExtension cp = (CertificatePoliciesExtension) mExt; - Vector cpv = (Vector) cp.get("infos"); + CertificatePoliciesExtension cp = (CertificatePoliciesExtension) mExt; + Vector cpv = (Vector) cp.get("infos"); Enumeration e = cpv.elements(); if (e != null) { while (e.hasMoreElements()) { CertificatePolicyInfo cpi = (CertificatePolicyInfo) e.nextElement(); - sb.append(pp.indent(mIndentSize + 8) + cpi.getPolicyIdentifier().getIdentifier().toString() + "\n"); + sb.append(pp.indent(mIndentSize + 8) + "Policy Identifier: " + cpi.getPolicyIdentifier().getIdentifier().toString() + "\n"); + PolicyQualifiers cpq = cpi.getPolicyQualifiers(); + if (cpq != null) { + for (int i=0; i < cpq.size(); i++) { + PolicyQualifierInfo pq = cpq.getInfoAt(i); + Qualifier q = pq.getQualifier(); + if (q instanceof CPSuri) { + sb.append(pp.indent(mIndentSize + 12) + "Policy Qualifier Identifier: CPS Pointer Qualifier - " + + pq.getId() + "\n"); + sb.append(pp.indent(mIndentSize + 12) + "Policy Qualifier Data: " + ((CPSuri) q).getURI() + "\n"); + } + else if (q instanceof UserNotice) { + sb.append(pp.indent(mIndentSize + 12) + "Policy Qualifier Identifier: CPS User Notice Qualifier - " + + pq.getId() + "\n"); + NoticeReference nref = ((UserNotice) q).getNoticeReference(); + DisplayText dt = ((UserNotice) q).getDisplayText(); + sb.append(pp.indent(mIndentSize +12) + "Policy Qualifier Data: \n"); + if (nref != null) { + sb.append(pp.indent(mIndentSize+16) + "Organization: " + nref.getOrganization().toString() + "\n" ); + sb.append(pp.indent(mIndentSize+16) + "Notice Numbers: " ); + int[] nums = nref.getNumbers(); + for (int k=0; k<nums.length; k++) { + if (k != 0) { + sb.append(","); + sb.append(nums[k]); + } else { + sb.append(nums[k]); + } + } + sb.append("\n"); + } + if (dt != null) { + sb.append(pp.indent(mIndentSize+16) + "Explicit Text: " + dt.toString() + "\n"); + } + } + } + } } } return sb.toString(); diff --git a/pki/base/util/src/netscape/security/x509/DisplayText.java b/pki/base/util/src/netscape/security/x509/DisplayText.java index c388b4987..45bcc5061 100644 --- a/pki/base/util/src/netscape/security/x509/DisplayText.java +++ b/pki/base/util/src/netscape/security/x509/DisplayText.java @@ -66,4 +66,19 @@ public class DisplayText { public String getText() { return mS; } + + public String toString() { + if (mTag == tag_IA5String) { + return "IA5String: " + mS; + } + else if (mTag == tag_BMPString) { + return "BMPString: " + mS; + } + else if (mTag == tag_VisibleString) { + return "VisibleString: " + mS; + } + else { + return "UTF8String: " + mS; + } + } } |