public static GetInstance ( Asn1TaggedObject obj, bool isExplicit ) : |
||
obj | Asn1TaggedObject | |
isExplicit | bool | |
Résultat |
/** * Constructor from Asn1Sequence. * <p/> * The sequence is of type ProcurationSyntax: * <p/> * <pre> * Admissions ::= SEQUENCE * { * admissionAuthority [0] EXPLICIT GeneralName OPTIONAL * namingAuthority [1] EXPLICIT NamingAuthority OPTIONAL * professionInfos SEQUENCE OF ProfessionInfo * } * </pre> * * @param seq The ASN.1 sequence. */ private Admissions( Asn1Sequence seq) { if (seq.Count > 3) { throw new ArgumentException("Bad sequence size: " + seq.Count); } IEnumerator e = seq.GetEnumerator(); e.MoveNext(); Asn1Encodable o = (Asn1Encodable)e.Current; if (o is Asn1TaggedObject) { switch (((Asn1TaggedObject)o).TagNo) { case 0: admissionAuthority = GeneralName.GetInstance((Asn1TaggedObject)o, true); break; case 1: namingAuthority = NamingAuthority.GetInstance((Asn1TaggedObject)o, true); break; default: throw new ArgumentException("Bad tag number: " + ((Asn1TaggedObject)o).TagNo); } e.MoveNext(); o = (Asn1Encodable)e.Current; } if (o is Asn1TaggedObject) { switch (((Asn1TaggedObject)o).TagNo) { case 1: namingAuthority = NamingAuthority.GetInstance((Asn1TaggedObject)o, true); break; default: throw new ArgumentException("Bad tag number: " + ((Asn1TaggedObject)o).TagNo); } e.MoveNext(); o = (Asn1Encodable)e.Current; } professionInfos = Asn1Sequence.GetInstance(o); if (e.MoveNext()) { throw new ArgumentException("Bad object encountered: " + e.Current.GetType().Name); } }
public static NamingAuthority GetInstance(Asn1TaggedObject obj, bool isExplicit) { return(NamingAuthority.GetInstance(Asn1Sequence.GetInstance(obj, isExplicit))); }
/** * Constructor from Asn1Sequence. * <p/> * <p/> * <pre> * ProfessionInfo ::= SEQUENCE * { * namingAuthority [0] EXPLICIT NamingAuthority OPTIONAL, * professionItems SEQUENCE OF DirectoryString (SIZE(1..128)), * professionOids SEQUENCE OF OBJECT IDENTIFIER OPTIONAL, * registrationNumber PrintableString(SIZE(1..128)) OPTIONAL, * addProfessionInfo OCTET STRING OPTIONAL * } * </pre> * * @param seq The ASN.1 sequence. */ private ProfessionInfo( Asn1Sequence seq) { if (seq.Count > 5) { throw new ArgumentException("Bad sequence size: " + seq.Count); } IEnumerator e = seq.GetEnumerator(); e.MoveNext(); Asn1Encodable o = (Asn1Encodable)e.Current; if (o is Asn1TaggedObject) { Asn1TaggedObject ato = (Asn1TaggedObject)o; if (ato.TagNo != 0) { throw new ArgumentException("Bad tag number: " + ato.TagNo); } namingAuthority = NamingAuthority.GetInstance(ato, true); e.MoveNext(); o = (Asn1Encodable)e.Current; } professionItems = Asn1Sequence.GetInstance(o); if (e.MoveNext()) { o = (Asn1Encodable)e.Current; if (o is Asn1Sequence) { professionOids = Asn1Sequence.GetInstance(o); } else if (o is DerPrintableString) { registrationNumber = DerPrintableString.GetInstance(o).GetString(); } else if (o is Asn1OctetString) { addProfessionInfo = Asn1OctetString.GetInstance(o); } else { throw new ArgumentException("Bad object encountered: " + Platform.GetTypeName(o)); } } if (e.MoveNext()) { o = (Asn1Encodable)e.Current; if (o is DerPrintableString) { registrationNumber = DerPrintableString.GetInstance(o).GetString(); } else if (o is DerOctetString) { addProfessionInfo = (DerOctetString)o; } else { throw new ArgumentException("Bad object encountered: " + Platform.GetTypeName(o)); } } if (e.MoveNext()) { o = (Asn1Encodable)e.Current; if (o is DerOctetString) { addProfessionInfo = (DerOctetString)o; } else { throw new ArgumentException("Bad object encountered: " + Platform.GetTypeName(o)); } } }
private ProfessionInfo(Asn1Sequence seq) { if (seq.Count > 5) { throw new ArgumentException("Bad sequence size: " + seq.Count); } IEnumerator enumerator = seq.GetEnumerator(); enumerator.MoveNext(); Asn1Encodable asn1Encodable = (Asn1Encodable)enumerator.Current; if (asn1Encodable is Asn1TaggedObject) { Asn1TaggedObject asn1TaggedObject = (Asn1TaggedObject)asn1Encodable; if (asn1TaggedObject.TagNo != 0) { throw new ArgumentException("Bad tag number: " + asn1TaggedObject.TagNo); } this.namingAuthority = NamingAuthority.GetInstance(asn1TaggedObject, true); enumerator.MoveNext(); asn1Encodable = (Asn1Encodable)enumerator.Current; } this.professionItems = Asn1Sequence.GetInstance(asn1Encodable); if (enumerator.MoveNext()) { asn1Encodable = (Asn1Encodable)enumerator.Current; if (asn1Encodable is Asn1Sequence) { this.professionOids = Asn1Sequence.GetInstance(asn1Encodable); } else if (asn1Encodable is DerPrintableString) { this.registrationNumber = DerPrintableString.GetInstance(asn1Encodable).GetString(); } else { if (!(asn1Encodable is Asn1OctetString)) { throw new ArgumentException("Bad object encountered: " + asn1Encodable.GetType().Name); } this.addProfessionInfo = Asn1OctetString.GetInstance(asn1Encodable); } } if (enumerator.MoveNext()) { asn1Encodable = (Asn1Encodable)enumerator.Current; if (asn1Encodable is DerPrintableString) { this.registrationNumber = DerPrintableString.GetInstance(asn1Encodable).GetString(); } else { if (!(asn1Encodable is DerOctetString)) { throw new ArgumentException("Bad object encountered: " + asn1Encodable.GetType().Name); } this.addProfessionInfo = (DerOctetString)asn1Encodable; } } if (!enumerator.MoveNext()) { return; } asn1Encodable = (Asn1Encodable)enumerator.Current; if (asn1Encodable is DerOctetString) { this.addProfessionInfo = (DerOctetString)asn1Encodable; return; } throw new ArgumentException("Bad object encountered: " + asn1Encodable.GetType().Name); }