1b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallampackage org.bouncycastle.asn1.x509; 2b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 370c8287138e69a98c2f950036f9f703ee37228c8Brian Carlstromimport org.bouncycastle.asn1.ASN1Boolean; 4c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstromimport org.bouncycastle.asn1.ASN1EncodableVector; 54c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstromimport org.bouncycastle.asn1.ASN1Object; 64c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstromimport org.bouncycastle.asn1.ASN1Primitive; 7b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallamimport org.bouncycastle.asn1.ASN1Sequence; 8b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallamimport org.bouncycastle.asn1.ASN1TaggedObject; 9c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstromimport org.bouncycastle.asn1.DERSequence; 10c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstromimport org.bouncycastle.asn1.DERTaggedObject; 11b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 12b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam/** 13c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom * <pre> 14c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom * IssuingDistributionPoint ::= SEQUENCE { 15c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom * distributionPoint [0] DistributionPointName OPTIONAL, 16c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom * onlyContainsUserCerts [1] BOOLEAN DEFAULT FALSE, 17c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom * onlyContainsCACerts [2] BOOLEAN DEFAULT FALSE, 18c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom * onlySomeReasons [3] ReasonFlags OPTIONAL, 19c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom * indirectCRL [4] BOOLEAN DEFAULT FALSE, 20c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom * onlyContainsAttributeCerts [5] BOOLEAN DEFAULT FALSE } 21c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom * </pre> 22b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam */ 23b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallampublic class IssuingDistributionPoint 244c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom extends ASN1Object 25b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam{ 26c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom private DistributionPointName distributionPoint; 27b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 28c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom private boolean onlyContainsUserCerts; 29c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom 30c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom private boolean onlyContainsCACerts; 31c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom 32c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom private ReasonFlags onlySomeReasons; 33c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom 34c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom private boolean indirectCRL; 35c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom 36c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom private boolean onlyContainsAttributeCerts; 37c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom 38c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom private ASN1Sequence seq; 39b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 40b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam public static IssuingDistributionPoint getInstance( 41b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam ASN1TaggedObject obj, 42c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom boolean explicit) 43b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam { 44b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam return getInstance(ASN1Sequence.getInstance(obj, explicit)); 45b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam } 46b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 47b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam public static IssuingDistributionPoint getInstance( 48c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom Object obj) 49b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam { 504c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom if (obj instanceof IssuingDistributionPoint) 51b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam { 52b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam return (IssuingDistributionPoint)obj; 53b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam } 544c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom else if (obj != null) 55b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam { 564c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom return new IssuingDistributionPoint(ASN1Sequence.getInstance(obj)); 57b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam } 58b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 594c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom return null; 60c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom } 61c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom 62c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom /** 63c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom * Constructor from given details. 64c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom * 65c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom * @param distributionPoint 66c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom * May contain an URI as pointer to most current CRL. 67c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom * @param onlyContainsUserCerts Covers revocation information for end certificates. 68c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom * @param onlyContainsCACerts Covers revocation information for CA certificates. 69c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom * 70c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom * @param onlySomeReasons 71c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom * Which revocation reasons does this point cover. 72c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom * @param indirectCRL 73c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom * If <code>true</code> then the CRL contains revocation 74c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom * information about certificates ssued by other CAs. 75c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom * @param onlyContainsAttributeCerts Covers revocation information for attribute certificates. 76c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom */ 77c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom public IssuingDistributionPoint( 78c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom DistributionPointName distributionPoint, 79c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom boolean onlyContainsUserCerts, 80c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom boolean onlyContainsCACerts, 81c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom ReasonFlags onlySomeReasons, 82c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom boolean indirectCRL, 83c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom boolean onlyContainsAttributeCerts) 84c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom { 85c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom this.distributionPoint = distributionPoint; 86c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom this.indirectCRL = indirectCRL; 87c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom this.onlyContainsAttributeCerts = onlyContainsAttributeCerts; 88c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom this.onlyContainsCACerts = onlyContainsCACerts; 89c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom this.onlyContainsUserCerts = onlyContainsUserCerts; 90c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom this.onlySomeReasons = onlySomeReasons; 91c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom 92c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom ASN1EncodableVector vec = new ASN1EncodableVector(); 93c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom if (distributionPoint != null) 94c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom { // CHOICE item so explicitly tagged 95c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom vec.add(new DERTaggedObject(true, 0, distributionPoint)); 96c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom } 97c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom if (onlyContainsUserCerts) 98c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom { 9970c8287138e69a98c2f950036f9f703ee37228c8Brian Carlstrom vec.add(new DERTaggedObject(false, 1, ASN1Boolean.getInstance(true))); 100c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom } 101c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom if (onlyContainsCACerts) 102c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom { 10370c8287138e69a98c2f950036f9f703ee37228c8Brian Carlstrom vec.add(new DERTaggedObject(false, 2, ASN1Boolean.getInstance(true))); 104c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom } 105c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom if (onlySomeReasons != null) 106c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom { 107c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom vec.add(new DERTaggedObject(false, 3, onlySomeReasons)); 108c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom } 109c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom if (indirectCRL) 110c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom { 11170c8287138e69a98c2f950036f9f703ee37228c8Brian Carlstrom vec.add(new DERTaggedObject(false, 4, ASN1Boolean.getInstance(true))); 112c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom } 113c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom if (onlyContainsAttributeCerts) 114c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom { 11570c8287138e69a98c2f950036f9f703ee37228c8Brian Carlstrom vec.add(new DERTaggedObject(false, 5, ASN1Boolean.getInstance(true))); 116c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom } 117c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom 118c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom seq = new DERSequence(vec); 119b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam } 120b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 121b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam /** 1224c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom * Shorthand Constructor from given details. 1234c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom * 1244c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom * @param distributionPoint 1254c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom * May contain an URI as pointer to most current CRL. 1264c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom * @param indirectCRL 1274c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom * If <code>true</code> then the CRL contains revocation 1284c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom * information about certificates ssued by other CAs. 1294c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom * @param onlyContainsAttributeCerts Covers revocation information for attribute certificates. 130b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam */ 131b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam public IssuingDistributionPoint( 1324c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom DistributionPointName distributionPoint, 1334c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom boolean indirectCRL, 1344c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom boolean onlyContainsAttributeCerts) 1354c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom { 1364c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom this(distributionPoint, false, false, null, indirectCRL, onlyContainsAttributeCerts); 1374c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom } 1384c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom 1394c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom /** 1404c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom * Constructor from ASN1Sequence 1414c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom */ 1424c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom private IssuingDistributionPoint( 143c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom ASN1Sequence seq) 144b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam { 145b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam this.seq = seq; 146b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 147b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam for (int i = 0; i != seq.size(); i++) 148b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam { 149c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom ASN1TaggedObject o = ASN1TaggedObject.getInstance(seq.getObjectAt(i)); 150b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 151b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam switch (o.getTagNo()) 152b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam { 153b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam case 0: 154c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom // CHOICE so explicit 155c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom distributionPoint = DistributionPointName.getInstance(o, true); 156b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam break; 157b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam case 1: 15870c8287138e69a98c2f950036f9f703ee37228c8Brian Carlstrom onlyContainsUserCerts = ASN1Boolean.getInstance(o, false).isTrue(); 159b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam break; 160b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam case 2: 16170c8287138e69a98c2f950036f9f703ee37228c8Brian Carlstrom onlyContainsCACerts = ASN1Boolean.getInstance(o, false).isTrue(); 162b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam break; 163b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam case 3: 164c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom onlySomeReasons = new ReasonFlags(ReasonFlags.getInstance(o, false)); 165b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam break; 166b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam case 4: 16770c8287138e69a98c2f950036f9f703ee37228c8Brian Carlstrom indirectCRL = ASN1Boolean.getInstance(o, false).isTrue(); 168b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam break; 169b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam case 5: 17070c8287138e69a98c2f950036f9f703ee37228c8Brian Carlstrom onlyContainsAttributeCerts = ASN1Boolean.getInstance(o, false).isTrue(); 171b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam break; 172b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam default: 173c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom throw new IllegalArgumentException( 174c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom "unknown tag in IssuingDistributionPoint"); 175b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam } 176b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam } 177b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam } 178b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 179b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam public boolean onlyContainsUserCerts() 180b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam { 181b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam return onlyContainsUserCerts; 182b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam } 183b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 184b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam public boolean onlyContainsCACerts() 185b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam { 186b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam return onlyContainsCACerts; 187b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam } 188b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 189b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam public boolean isIndirectCRL() 190b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam { 191b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam return indirectCRL; 192b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam } 193b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 194b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam public boolean onlyContainsAttributeCerts() 195b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam { 196b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam return onlyContainsAttributeCerts; 197b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam } 198b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 199c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom /** 200c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom * @return Returns the distributionPoint. 201c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom */ 202c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom public DistributionPointName getDistributionPoint() 203c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom { 204c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom return distributionPoint; 205c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom } 206c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom 207c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom /** 208c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom * @return Returns the onlySomeReasons. 209c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom */ 210c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom public ReasonFlags getOnlySomeReasons() 211c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom { 212c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom return onlySomeReasons; 213c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom } 214c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom 2154c111300c39cb2e27f07fc2ae3b00e23ed4443b2Brian Carlstrom public ASN1Primitive toASN1Primitive() 216b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam { 217b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam return seq; 218b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam } 219c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom 220c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom public String toString() 221c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom { 222c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom String sep = System.getProperty("line.separator"); 223c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom StringBuffer buf = new StringBuffer(); 224c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom 225c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom buf.append("IssuingDistributionPoint: ["); 226c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom buf.append(sep); 227c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom if (distributionPoint != null) 228c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom { 229c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom appendObject(buf, sep, "distributionPoint", distributionPoint.toString()); 230c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom } 231c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom if (onlyContainsUserCerts) 232c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom { 233c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom appendObject(buf, sep, "onlyContainsUserCerts", booleanToString(onlyContainsUserCerts)); 234c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom } 235c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom if (onlyContainsCACerts) 236c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom { 237c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom appendObject(buf, sep, "onlyContainsCACerts", booleanToString(onlyContainsCACerts)); 238c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom } 239c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom if (onlySomeReasons != null) 240c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom { 241c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom appendObject(buf, sep, "onlySomeReasons", onlySomeReasons.toString()); 242c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom } 243c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom if (onlyContainsAttributeCerts) 244c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom { 245c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom appendObject(buf, sep, "onlyContainsAttributeCerts", booleanToString(onlyContainsAttributeCerts)); 246c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom } 247c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom if (indirectCRL) 248c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom { 249c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom appendObject(buf, sep, "indirectCRL", booleanToString(indirectCRL)); 250c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom } 251c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom buf.append("]"); 252c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom buf.append(sep); 253c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom return buf.toString(); 254c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom } 255c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom 256c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom private void appendObject(StringBuffer buf, String sep, String name, String value) 257c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom { 258c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom String indent = " "; 259c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom 260c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom buf.append(indent); 261c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom buf.append(name); 262c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom buf.append(":"); 263c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom buf.append(sep); 264c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom buf.append(indent); 265c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom buf.append(indent); 266c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom buf.append(value); 267c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom buf.append(sep); 268c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom } 269c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom 270c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom private String booleanToString(boolean value) 271c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom { 272c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom return value ? "true" : "false"; 273c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom } 274b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam} 275