List of usage examples for org.bouncycastle.asn1.x509 GeneralNames getInstance
public static GeneralNames getInstance(ASN1TaggedObject obj, boolean explicit)
From source file:org.glite.voms.ac.Holder.java
License:eu-egee.org license
public Holder(ASN1Sequence seq) throws IOException { for (Enumeration e = seq.getObjects(); e.hasMoreElements();) { ASN1Primitive obj = (ASN1Primitive) e.nextElement(); if (!(obj instanceof ASN1TaggedObject)) { throw new IllegalArgumentException("Holder element not tagged"); }/*from w ww. j a v a2 s. c o m*/ ASN1TaggedObject tObj = (ASN1TaggedObject) obj; switch (tObj.getTagNo()) { case 0: baseCertificateID = IssuerSerial.getInstance((ASN1Sequence) tObj.getObject()); break; case 1: entityName = GeneralNames.getInstance(tObj, false); break; case 2: objectDigestInfo = new ObjectDigestInfo((ASN1Sequence) tObj.getObject()); break; default: throw new IllegalArgumentException("Unknown tag number " + tObj.getTagNo()); } } }
From source file:org.glite.voms.ac.IetfAttrSyntax.java
License:eu-egee.org license
/** * *//*ww w . ja v a 2 s .c o m*/ public IetfAttrSyntax(ASN1Sequence seq) { int i = 0; if (seq.getObjectAt(0) instanceof ASN1TaggedObject) { policyAuthority = GeneralNames.getInstance((ASN1TaggedObject) seq.getObjectAt(0), /*explicit=*/ false); i++; } if (!(seq.getObjectAt(i) instanceof ASN1Sequence)) { throw new IllegalArgumentException("Non-IetfAttrSyntax encoding"); } seq = (ASN1Sequence) seq.getObjectAt(i); for (Enumeration e = seq.getObjects(); e.hasMoreElements();) { ASN1Primitive obj = (ASN1Primitive) e.nextElement(); int type; if (obj instanceof DERObjectIdentifier) { type = VALUE_OID; } else if (obj instanceof DERUniversalString) { type = VALUE_UTF8; } else if (obj instanceof DEROctetString) { type = VALUE_OCTETS; } else { throw new IllegalArgumentException("Bad value type encoding IetfAttrSyntax"); } if (valueChoice < 0) { valueChoice = type; } if (type != valueChoice) { throw new IllegalArgumentException("Mix of value types in IetfAttrSyntax"); } values.add(obj); } }
From source file:org.glite.voms.PKIUtils.java
License:Open Source License
static private GeneralNames getAuthorityCertIssuer(AuthorityKeyIdentifier akid) { ASN1Primitive obj = akid.toASN1Primitive(); ASN1Sequence seq = ASN1Sequence.getInstance(obj); for (int i = 0; i < seq.size(); i++) { ASN1Primitive o = (ASN1Primitive) seq.getObjectAt(i); if ((o instanceof ASN1TaggedObject) && (((ASN1TaggedObject) o).getTagNo() == 1)) { return GeneralNames.getInstance(((DERTaggedObject) o), false); // DERObject realObject = ((ASN1TaggedObject)o).getObject(); // if (realObject instanceof GeneralNames) { // return ((GeneralNames)realObject); // } }/*from w w w.j ava 2 s. c o m*/ } return null; }