/** * Constructor that builds an instance of <code>RoleSyntax</code> by * extracting the encoded elements from the <code>Asn1Sequence</code> * object supplied. * @param seq an instance of <code>Asn1Sequence</code> that holds * the encoded elements used to build this <code>RoleSyntax</code>. */ private RoleSyntax( Asn1Sequence seq) { if (seq.Count < 1 || seq.Count > 2) { throw new ArgumentException("Bad sequence size: " + seq.Count); } for (int i = 0; i != seq.Count; i++) { Asn1TaggedObject taggedObject = Asn1TaggedObject.GetInstance(seq[i]); switch (taggedObject.TagNo) { case 0: roleAuthority = GeneralNames.GetInstance(taggedObject, false); break; case 1: roleName = GeneralName.GetInstance(taggedObject, true); break; default: throw new ArgumentException("Unknown tag in RoleSyntax"); } } }
private V2Form( Asn1Sequence seq) { if (seq.Count > 3) { throw new ArgumentException("Bad sequence size: " + seq.Count); } int index = 0; if (!(seq[0] is Asn1TaggedObject)) { index++; this.issuerName = GeneralNames.GetInstance(seq[0]); } for (int i = index; i != seq.Count; i++) { Asn1TaggedObject o = Asn1TaggedObject.GetInstance(seq[i]); if (o.TagNo == 0) { baseCertificateID = IssuerSerial.GetInstance(o, false); } else if (o.TagNo == 1) { objectDigestInfo = ObjectDigestInfo.GetInstance(o, false); } else { throw new ArgumentException("Bad tag number: " + o.TagNo); } } }
public static AttCertIssuer GetInstance( object obj) { if (obj is AttCertIssuer) { return((AttCertIssuer)obj); } else if (obj is V2Form) { return(new AttCertIssuer(V2Form.GetInstance(obj))); } else if (obj is GeneralNames) { return(new AttCertIssuer((GeneralNames)obj)); } else if (obj is Asn1TaggedObject) { return(new AttCertIssuer(V2Form.GetInstance((Asn1TaggedObject)obj, false))); } else if (obj is Asn1Sequence) { return(new AttCertIssuer(GeneralNames.GetInstance(obj))); } throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); }
/** * Constructor for a holder for an v2 attribute certificate. * * * @param seq The ASN.1 sequence. */ private Holder( Asn1Sequence seq) { if (seq.Count > 3) { throw new ArgumentException("Bad sequence size: " + seq.Count); } for (int i = 0; i != seq.Count; i++) { Asn1TaggedObject tObj = Asn1TaggedObject.GetInstance(seq[i]); switch (tObj.TagNo) { case 0: baseCertificateID = IssuerSerial.GetInstance(tObj, false); break; case 1: entityName = GeneralNames.GetInstance(tObj, false); break; case 2: objectDigestInfo = ObjectDigestInfo.GetInstance(tObj, false); break; default: throw new ArgumentException("unknown tag in Holder"); } } this.version = 1; }
/** * create an AuthorityKeyIdentifier with the GeneralNames tag and * the serial number provided. */ public AuthorityKeyIdentifier( GeneralNames name, BigInteger serialNumber) { this.keyidentifier = null; this.certissuer = GeneralNames.GetInstance(name.ToAsn1Object()); this.certserno = new DerInteger(serialNumber); }
/** * */ public IetfAttrSyntax( Asn1Sequence seq) { int i = 0; if (seq[0] is Asn1TaggedObject) { policyAuthority = GeneralNames.GetInstance(((Asn1TaggedObject)seq[0]), false); i++; } else if (seq.Count == 2) { // VOMS fix policyAuthority = GeneralNames.GetInstance(seq[0]); i++; } if (!(seq[i] is Asn1Sequence)) { throw new ArgumentException("Non-IetfAttrSyntax encoding"); } seq = (Asn1Sequence)seq[i]; foreach (Asn1Object obj in seq) { int type; if (obj is DerObjectIdentifier) { type = ValueOid; } else if (obj is DerUtf8String) { type = ValueUtf8; } else if (obj is DerOctetString) { type = ValueOctets; } else { throw new ArgumentException("Bad value type encoding IetfAttrSyntax"); } if (valueChoice < 0) { valueChoice = type; } if (type != valueChoice) { throw new ArgumentException("Mix of value types in IetfAttrSyntax"); } values.Add(obj); } }
public DistributionPointName( Asn1TaggedObject obj) { this.type = obj.TagNo; if (type == FullName) { this.name = GeneralNames.GetInstance(obj, false); } else { this.name = Asn1Set.GetInstance(obj, false); } }
private IssuerSerial( Asn1Sequence seq) { if (seq.Count != 2 && seq.Count != 3) { throw new ArgumentException("Bad sequence size: " + seq.Count); } issuer = GeneralNames.GetInstance(seq[0]); serial = DerInteger.GetInstance(seq[1]); if (seq.Count == 3) { issuerUid = DerBitString.GetInstance(seq[2]); } }
/** * Constructor for a holder for an v1 attribute certificate. * * @param tagObj The ASN.1 tagged holder object. */ public Holder( Asn1TaggedObject tagObj) { switch (tagObj.TagNo) { case 0: baseCertificateID = IssuerSerial.GetInstance(tagObj, false); break; case 1: entityName = GeneralNames.GetInstance(tagObj, false); break; default: throw new ArgumentException("unknown tag in Holder"); } this.version = 0; }
private DistributionPoint( Asn1Sequence seq) { for (int i = 0; i != seq.Count; i++) { Asn1TaggedObject t = Asn1TaggedObject.GetInstance(seq[i]); switch (t.TagNo) { case 0: distributionPoint = DistributionPointName.GetInstance(t, true); break; case 1: reasons = new ReasonFlags(DerBitString.GetInstance(t, false)); break; case 2: cRLIssuer = GeneralNames.GetInstance(t, false); break; } } }
protected internal AuthorityKeyIdentifier( Asn1Sequence seq) { foreach (Asn1TaggedObject o in seq) { switch (o.TagNo) { case 0: this.keyidentifier = Asn1OctetString.GetInstance(o, false); break; case 1: this.certissuer = GeneralNames.GetInstance(o, false); break; case 2: this.certserno = DerInteger.GetInstance(o, false); break; default: throw new ArgumentException("illegal tag"); } } }