KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ca > commons > security > cert > extensions > CRLDistributionPoints


1
2 package com.ca.commons.security.cert.extensions;
3
4 import com.ca.commons.security.asn1.*;
5
6 /**
7  * <pre>
8  * cRLDistributionPoints ::= {
9  * CRLDistPointsSyntax }
10  *
11  * CRLDistPointsSyntax ::= SEQUENCE SIZE (1..MAX) OF DistributionPoint
12  *
13  * DistributionPoint ::= SEQUENCE {
14  * distributionPoint [0] DistributionPointName OPTIONAL,
15  * reasons [1] ReasonFlags OPTIONAL,
16  * cRLIssuer [2] GeneralNames OPTIONAL }
17  *
18  * DistributionPointName ::= CHOICE {
19  * fullName [0] GeneralNames,
20  * nameRelativeToCRLIssuer [1] RelativeDistinguishedName }
21  *
22  * ReasonFlags ::= BIT STRING {
23  * unused (0),
24  * keyCompromise (1),
25  * cACompromise (2),
26  * affiliationChanged (3),
27  * superseded (4),
28  * cessationOfOperation (5),
29  * certificateHold (6) }
30  *
31  * </pre>
32  *
33  * @author vbui
34  */

35 public class CRLDistributionPoints implements V3Extension
36 {
37     String JavaDoc value = null;
38
39     public void init(ASN1Object asn1object) throws Exception JavaDoc
40     {
41         if (!asn1object.isASN1Type(ASN1Type.SEQUENCE))
42             throw new Exception JavaDoc("Wrong ASN.1 type for CRLDistributionPoints");
43
44         for (int i = 0; i < asn1object.size(); i++)
45         {
46             ASN1Object distributionPoint = asn1object.getComponent(i);
47
48             if (!distributionPoint.isASN1Type(ASN1Type.SEQUENCE))
49                 throw new Exception JavaDoc("Wrong ASN.1 type for CRLDistributionPoints.distributionPoint");
50
51             for (int j = 0; j < distributionPoint.size(); j++)
52             {
53                 ASN1Object nextComp = distributionPoint.getComponent(j);
54
55                 if (j == 0)
56                 {
57                     ASN1Object fullName = (ASN1Object)((ASN1Object) nextComp.getValue()).getValue();
58
59                     if (value == null)
60                         value = IssuerAltName.getGNameString(fullName);
61                     else
62                         value = value + "\n" + IssuerAltName.getGNameString(fullName);
63
64                 }
65                 else if (j == 1)
66                 {
67                     System.out.println("Not reading CRLDistributionPoints.distributionPoint.reasons");
68                 }
69                 else if (j == 2)
70                 {
71                     System.out.println("Not reading CRLDistributionPoints.distributionPoint.cRLIssuer");
72                 }
73             }
74         }
75     }
76
77     public String JavaDoc toString()
78     {
79         return value;
80     }
81 }
82
83
Popular Tags