/** * @return Returns the professionItems. */ public virtual DirectoryString[] GetProfessionItems() { DirectoryString[] result = new DirectoryString[professionItems.Count]; for (int i = 0; i < professionItems.Count; ++i) { result[i] = DirectoryString.GetInstance(professionItems[i]); } return(result); }
public DirectoryString[] GetGivenName() { DirectoryString[] array = new DirectoryString[givenName.Count]; int num = 0; foreach (object item in givenName) { array[num++] = DirectoryString.GetInstance(item); } return(array); }
public DirectoryString[] GetGivenName() { DirectoryString[] items = new DirectoryString[givenName.Count]; int count = 0; foreach (object o in givenName) { items[count++] = DirectoryString.GetInstance(o); } return(items); }
/** * Constructor from Asn1Sequence. * <p/> * The sequence is of type NameOrPseudonym: * <p/> * <pre> * NameOrPseudonym ::= CHOICE { * surAndGivenName SEQUENCE { * surName DirectoryString, * givenName SEQUENCE OF DirectoryString * }, * pseudonym DirectoryString * } * </pre> * * @param seq The ASN.1 sequence. */ private NameOrPseudonym( Asn1Sequence seq) { if (seq.Count != 2) throw new ArgumentException("Bad sequence size: " + seq.Count); if (!(seq[0] is IAsn1String)) throw new ArgumentException("Bad object encountered: " + seq[0].GetType().Name); surname = DirectoryString.GetInstance(seq[0]); givenName = Asn1Sequence.GetInstance(seq[1]); }
public static Restriction GetInstance(object obj) { if (obj is Restriction) { return((Restriction)obj); } if (obj is IAsn1String) { return(new Restriction(DirectoryString.GetInstance(obj))); } throw new ArgumentException("Unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj"); }
public static AdditionalInformationSyntax GetInstance(object obj) { if (obj is AdditionalInformationSyntax) { return((AdditionalInformationSyntax)obj); } if (obj is IAsn1String) { return(new AdditionalInformationSyntax(DirectoryString.GetInstance(obj))); } throw new ArgumentException("Unknown object in GetInstance: " + obj.GetType().Name, "obj"); }
public static AdditionalInformationSyntax GetInstance(object obj) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) if (obj is AdditionalInformationSyntax) { return((AdditionalInformationSyntax)obj); } if (obj is IAsn1String) { return(new AdditionalInformationSyntax(DirectoryString.GetInstance(obj))); } throw new ArgumentException("Unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj"); }
public static AdditionalInformationSyntax GetInstance( object obj) { if (obj is AdditionalInformationSyntax) { return((AdditionalInformationSyntax)obj); } if (obj is IAsn1String) { return(new AdditionalInformationSyntax(DirectoryString.GetInstance(obj))); } throw new ArgumentException("Unknown object in GetInstance: " + BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj"); }
private NameOrPseudonym(Asn1Sequence seq) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (seq.Count != 2) { throw new ArgumentException(string.Concat((object)"Bad sequence size: ", (object)seq.Count)); } if (!(seq[0] is IAsn1String)) { throw new ArgumentException("Bad object encountered: " + Platform.GetTypeName(seq[0])); } surname = DirectoryString.GetInstance(seq[0]); givenName = Asn1Sequence.GetInstance(seq[1]); }
public static Restriction GetInstance( object obj) { if (obj == null || obj is Restriction) { return (Restriction) obj; } if (obj is IAsn1String) { return new Restriction(DirectoryString.GetInstance(obj)); } throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); }
public DirectoryString[] GetPostal() { if (postalAddress == null) { return(null); } DirectoryString[] dirStrings = new DirectoryString[postalAddress.Count]; for (int i = 0; i != dirStrings.Length; i++) { dirStrings[i] = DirectoryString.GetInstance(postalAddress[i]); } return(dirStrings); }
/** * Constructor from Asn1Sequence. * <p/> * The sequence is of type NameOrPseudonym: * <p/> * <pre> * NameOrPseudonym ::= CHOICE { * surAndGivenName SEQUENCE { * surName DirectoryString, * givenName SEQUENCE OF DirectoryString * }, * pseudonym DirectoryString * } * </pre> * * @param seq The ASN.1 sequence. */ private NameOrPseudonym( Asn1Sequence seq) { if (seq.Count != 2) { throw new ArgumentException("Bad sequence size: " + seq.Count); } if (!(seq[0] is IAsn1String)) { throw new ArgumentException("Bad object encountered: " + BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.GetTypeName(seq[0])); } surname = DirectoryString.GetInstance(seq[0]); givenName = Asn1Sequence.GetInstance(seq[1]); }
public static NameOrPseudonym GetInstance(object obj) { if (obj == null || obj is NameOrPseudonym) { return((NameOrPseudonym)obj); } if (obj is IAsn1String) { return(new NameOrPseudonym(DirectoryString.GetInstance(obj))); } if (obj is Asn1Sequence) { return(new NameOrPseudonym((Asn1Sequence)obj)); } throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); }
public static NameOrPseudonym GetInstance(object obj) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (obj == null || obj is NameOrPseudonym) { return((NameOrPseudonym)obj); } if (obj is IAsn1String) { return(new NameOrPseudonym(DirectoryString.GetInstance(obj))); } if (obj is Asn1Sequence) { return(new NameOrPseudonym((Asn1Sequence)obj)); } throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); }
/** * Constructor from Asn1Sequence. * <p/> * The sequence is of type NameOrPseudonym: * <p/> * <pre> * PersonalData ::= SEQUENCE { * nameOrPseudonym NameOrPseudonym, * nameDistinguisher [0] INTEGER OPTIONAL, * dateOfBirth [1] GeneralizedTime OPTIONAL, * placeOfBirth [2] DirectoryString OPTIONAL, * gender [3] PrintableString OPTIONAL, * postalAddress [4] DirectoryString OPTIONAL * } * </pre> * * @param seq The ASN.1 sequence. */ private PersonalData( Asn1Sequence seq) { if (seq.Count < 1) { throw new ArgumentException("Bad sequence size: " + seq.Count); } IEnumerator e = seq.GetEnumerator(); e.MoveNext(); nameOrPseudonym = NameOrPseudonym.GetInstance(e.Current); while (e.MoveNext()) { Asn1TaggedObject o = Asn1TaggedObject.GetInstance(e.Current); int tag = o.TagNo; switch (tag) { case 0: nameDistinguisher = DerInteger.GetInstance(o, false).Value; break; case 1: dateOfBirth = DerGeneralizedTime.GetInstance(o, false); break; case 2: placeOfBirth = DirectoryString.GetInstance(o, true); break; case 3: gender = DerPrintableString.GetInstance(o, false).GetString(); break; case 4: postalAddress = DirectoryString.GetInstance(o, true); break; default: throw new ArgumentException("Bad tag number: " + o.TagNo); } } }
public static NameOrPseudonym GetInstance( object obj) { if (obj == null || obj is NameOrPseudonym) { return((NameOrPseudonym)obj); } if (obj is IAsn1String) { return(new NameOrPseudonym(DirectoryString.GetInstance(obj))); } if (obj is Asn1Sequence) { return(new NameOrPseudonym((Asn1Sequence)obj)); } throw new ArgumentException("unknown object in factory: " + BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj"); }
private PersonalData(Asn1Sequence seq) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) if (seq.Count < 1) { throw new ArgumentException(string.Concat((object)"Bad sequence size: ", (object)seq.Count)); } global::System.Collections.IEnumerator enumerator = seq.GetEnumerator(); enumerator.MoveNext(); nameOrPseudonym = NameOrPseudonym.GetInstance(enumerator.get_Current()); while (enumerator.MoveNext()) { Asn1TaggedObject instance = Asn1TaggedObject.GetInstance(enumerator.get_Current()); switch (instance.TagNo) { case 0: nameDistinguisher = DerInteger.GetInstance(instance, isExplicit: false).Value; break; case 1: dateOfBirth = DerGeneralizedTime.GetInstance(instance, isExplicit: false); break; case 2: placeOfBirth = DirectoryString.GetInstance(instance, isExplicit: true); break; case 3: gender = DerPrintableString.GetInstance(instance, isExplicit: false).GetString(); break; case 4: postalAddress = DirectoryString.GetInstance(instance, isExplicit: true); break; default: throw new ArgumentException(string.Concat((object)"Bad tag number: ", (object)instance.TagNo)); } } }
private ProcurationSyntax(Asn1Sequence seq) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) if (seq.Count < 1 || seq.Count > 3) { throw new ArgumentException(string.Concat((object)"Bad sequence size: ", (object)seq.Count)); } global::System.Collections.IEnumerator enumerator = seq.GetEnumerator(); while (enumerator.MoveNext()) { Asn1TaggedObject instance = Asn1TaggedObject.GetInstance(enumerator.get_Current()); switch (instance.TagNo) { case 1: country = DerPrintableString.GetInstance(instance, isExplicit: true).GetString(); break; case 2: typeOfSubstitution = DirectoryString.GetInstance(instance, isExplicit: true); break; case 3: { Asn1Object @object = instance.GetObject(); if (@object is Asn1TaggedObject) { thirdPerson = GeneralName.GetInstance(@object); } else { certRef = IssuerSerial.GetInstance(@object); } break; } default: throw new ArgumentException(string.Concat((object)"Bad tag number: ", (object)instance.TagNo)); } } }
private ProcurationSyntax(Asn1Sequence seq) { if (seq.Count < 1 || seq.Count > 3) { throw new ArgumentException("Bad sequence size: " + seq.Count); } IEnumerator enumerator = seq.GetEnumerator(); while (enumerator.MoveNext()) { Asn1TaggedObject instance = Asn1TaggedObject.GetInstance(enumerator.Current); switch (instance.TagNo) { case 1: this.country = DerPrintableString.GetInstance(instance, true).GetString(); break; case 2: this.typeOfSubstitution = DirectoryString.GetInstance(instance, true); break; case 3: { Asn1Object @object = instance.GetObject(); if (@object is Asn1TaggedObject) { this.thirdPerson = GeneralName.GetInstance(@object); } else { this.certRef = IssuerSerial.GetInstance(@object); } break; } default: throw new ArgumentException("Bad tag number: " + instance.TagNo); } } }
/** * Constructor from Asn1Sequence. * <p/> * The sequence is of type ProcurationSyntax: * <p/> * <pre> * ProcurationSyntax ::= SEQUENCE { * country [1] EXPLICIT PrintableString(SIZE(2)) OPTIONAL, * typeOfSubstitution [2] EXPLICIT DirectoryString (SIZE(1..128)) OPTIONAL, * signingFor [3] EXPLICIT SigningFor * } * <p/> * SigningFor ::= CHOICE * { * thirdPerson GeneralName, * certRef IssuerSerial * } * </pre> * * @param seq The ASN.1 sequence. */ private ProcurationSyntax( Asn1Sequence seq) { if (seq.Count < 1 || seq.Count > 3) { throw new ArgumentException("Bad sequence size: " + seq.Count); } IEnumerator e = seq.GetEnumerator(); while (e.MoveNext()) { Asn1TaggedObject o = Asn1TaggedObject.GetInstance(e.Current); switch (o.TagNo) { case 1: country = DerPrintableString.GetInstance(o, true).GetString(); break; case 2: typeOfSubstitution = DirectoryString.GetInstance(o, true); break; case 3: Asn1Object signingFor = o.GetObject(); if (signingFor is Asn1TaggedObject) { thirdPerson = GeneralName.GetInstance(signingFor); } else { certRef = IssuerSerial.GetInstance(signingFor); } break; default: throw new ArgumentException("Bad tag number: " + o.TagNo); } } }
public DirectoryString[] GetGivenName() { DirectoryString[] array = new DirectoryString[givenName.Count]; int num = 0; global::System.Collections.IEnumerator enumerator = givenName.GetEnumerator(); try { while (enumerator.MoveNext()) { object current = enumerator.get_Current(); array[num++] = DirectoryString.GetInstance(current); } return(array); } finally { global::System.IDisposable disposable = enumerator as global::System.IDisposable; if (disposable != null) { disposable.Dispose(); } } }
public override void PerformTest() { DerUtf8String countryName = new DerUtf8String("Australia"); SignerLocation sl = new SignerLocation(countryName, null, null); CheckConstruction(sl, DirectoryString.GetInstance(countryName), null, null); DerUtf8String localityName = new DerUtf8String("Melbourne"); sl = new SignerLocation(null, localityName, null); CheckConstruction(sl, null, DirectoryString.GetInstance(localityName), null); sl = new SignerLocation(countryName, localityName, null); CheckConstruction(sl, DirectoryString.GetInstance(countryName), DirectoryString.GetInstance(localityName), null); Asn1Sequence postalAddress = new DerSequence( new DerUtf8String("line 1"), new DerUtf8String("line 2")); sl = new SignerLocation(null, null, postalAddress); CheckConstruction(sl, null, null, postalAddress); sl = new SignerLocation(countryName, null, postalAddress); CheckConstruction(sl, DirectoryString.GetInstance(countryName), null, postalAddress); sl = new SignerLocation(countryName, localityName, postalAddress); CheckConstruction(sl, DirectoryString.GetInstance(countryName), DirectoryString.GetInstance(localityName), postalAddress); sl = SignerLocation.GetInstance(null); if (sl != null) { Fail("null GetInstance() failed."); } try { SignerLocation.GetInstance(new object()); Fail("GetInstance() failed to detect bad object."); } catch (ArgumentException) { // expected } // // out of range postal address // postalAddress = new DerSequence( new DerUtf8String("line 1"), new DerUtf8String("line 2"), new DerUtf8String("line 3"), new DerUtf8String("line 4"), new DerUtf8String("line 5"), new DerUtf8String("line 6"), new DerUtf8String("line 7")); try { new SignerLocation(null, null, postalAddress); Fail("constructor failed to detect bad postalAddress."); } catch (ArgumentException) { // expected } try { new SignerLocation(new DerSequence(new DerTaggedObject(2, postalAddress))); Fail("sequence constructor failed to detect bad postalAddress."); } catch (ArgumentException) { // expected } try { new SignerLocation(new DerSequence(new DerTaggedObject(5, postalAddress))); Fail("sequence constructor failed to detect bad tag."); } catch (ArgumentException) { // expected } }
/** * Constructor from Asn1Sequence. * <p/> * <p/> * <pre> * NamingAuthority ::= SEQUENCE * { * namingAuthorityID OBJECT IDENTIFIER OPTIONAL, * namingAuthorityUrl IA5String OPTIONAL, * namingAuthorityText DirectoryString(SIZE(1..128)) OPTIONAL * } * </pre> * * @param seq The ASN.1 sequence. */ private NamingAuthority( Asn1Sequence seq) { if (seq.Count > 3) { throw new ArgumentException("Bad sequence size: " + seq.Count); } IEnumerator e = seq.GetEnumerator(); if (e.MoveNext()) { Asn1Encodable o = (Asn1Encodable)e.Current; if (o is DerObjectIdentifier) { namingAuthorityID = (DerObjectIdentifier)o; } else if (o is DerIA5String) { namingAuthorityUrl = DerIA5String.GetInstance(o).GetString(); } else if (o is IAsn1String) { namingAuthorityText = DirectoryString.GetInstance(o); } else { throw new ArgumentException("Bad object encountered: " + Platform.GetTypeName(o)); } } if (e.MoveNext()) { Asn1Encodable o = (Asn1Encodable)e.Current; if (o is DerIA5String) { namingAuthorityUrl = DerIA5String.GetInstance(o).GetString(); } else if (o is IAsn1String) { namingAuthorityText = DirectoryString.GetInstance(o); } else { throw new ArgumentException("Bad object encountered: " + Platform.GetTypeName(o)); } } if (e.MoveNext()) { Asn1Encodable o = (Asn1Encodable)e.Current; if (o is IAsn1String) { namingAuthorityText = DirectoryString.GetInstance(o); } else { throw new ArgumentException("Bad object encountered: " + Platform.GetTypeName(o)); } } }