List of usage examples for org.bouncycastle.asn1.x509 DistributionPointName toASN1Object
public ASN1Primitive toASN1Object()
From source file:com.jlocksmith.util.ExtensionUtil.java
License:Open Source License
/** * Get Crl Distribution Points String Value * //from ww w . j av a 2 s . c om * @param bytes * @return * @throws IOException */ private String getCrlDistributionPointsStringValue(byte[] bytes) throws IOException { CRLDistPoint dps = CRLDistPoint.getInstance(toDERObject(bytes)); DistributionPoint[] points = dps.getDistributionPoints(); StringBuffer sb = new StringBuffer(); for (int i = 0, len = points.length; i < len; i++) { DistributionPoint point = points[i]; DistributionPointName dpn; if ((dpn = point.getDistributionPoint()) != null) { ASN1TaggedObject tagObj = (ASN1TaggedObject) dpn.toASN1Object(); switch (tagObj.getTagNo()) { case DistributionPointName.FULL_NAME: sb.append(localeUtil.getString("CrlDistributionPoint.0.0")); sb.append('\n'); ASN1Sequence seq = (ASN1Sequence) tagObj.getObject(); for (int j = 0, nLen = seq.size(); j < nLen; j++) { sb.append('\t'); sb.append(getGeneralNameString((DERTaggedObject) seq.getObjectAt(j))); sb.append('\n'); } break; case DistributionPointName.NAME_RELATIVE_TO_CRL_ISSUER: sb.append(localeUtil.getString("CrlDistributionPoint.0.1")); sb.append('\t'); sb.append(tagObj.getObject()); sb.append('\n'); break; default: break; } } ReasonFlags flags; if ((flags = point.getReasons()) != null) { sb.append(localeUtil.getString("CrlDistributionPoint.1")); sb.append('\t'); sb.append(flags); sb.append('\n'); } GeneralNames issuer; if ((issuer = point.getCRLIssuer()) != null) { sb.append(localeUtil.getString("CrlDistributionPoint.2")); sb.append('\n'); ASN1Sequence seq = (ASN1Sequence) issuer.getDERObject(); for (int j = 0, iLen = seq.size(); j < iLen; j++) { sb.append('\t'); sb.append(getGeneralNameString((DERTaggedObject) seq.getObjectAt(j))); sb.append('\n'); } } } return sb.toString(); }