public X509Name(global::System.Collections.IList ordering, IDictionary attributes, X509NameEntryConverter converter) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) this.converter = converter; global::System.Collections.IEnumerator enumerator = ((global::System.Collections.IEnumerable)ordering).GetEnumerator(); try { while (enumerator.MoveNext()) { DerObjectIdentifier derObjectIdentifier = (DerObjectIdentifier)enumerator.get_Current(); object obj = attributes.get_Item((object)derObjectIdentifier); if (obj == null) { throw new ArgumentException(string.Concat((object)"No attribute for object id - ", (object)derObjectIdentifier, (object)" - passed to distinguished name")); } this.ordering.Add((object)derObjectIdentifier); added.Add((object)false); values.Add(obj); } } finally { global::System.IDisposable disposable = enumerator as global::System.IDisposable; if (disposable != null) { disposable.Dispose(); } } }
public X509Name( ArrayList ordering, Hashtable attributes, X509NameEntryConverter converter) : this((IList)ordering, (IDictionary)attributes, converter) { }
/** * Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or * some such, converting it into an ordered set of name attributes with each * string value being converted to its associated ASN.1 type using the passed * in converter. If reverse is true the ASN.1 sequence representing the DN will * be built by starting at the end of the string, rather than the start. */ public X509Name( bool reverse, string dirName, X509NameEntryConverter converter) : this(reverse, DefaultLookup, dirName, converter) { }
public X509Name( ArrayList oids, ArrayList values, X509NameEntryConverter converter) : this((IList)oids, (IList)values, converter) { }
public X509Name(IList ordering, IDictionary attributes, X509NameEntryConverter converter) { this.ordering = Platform.CreateArrayList(); this.values = Platform.CreateArrayList(); this.added = Platform.CreateArrayList(); this.converter = converter; IEnumerator enumerator = ordering.GetEnumerator(); try { while (enumerator.MoveNext()) { DerObjectIdentifier current = (DerObjectIdentifier)enumerator.Current; object obj2 = attributes[current]; if (obj2 == null) { throw new ArgumentException("No attribute for object id - " + current + " - passed to distinguished name"); } this.ordering.Add(current); this.added.Add(false); this.values.Add(obj2); } } finally { if (enumerator is IDisposable disposable) { IDisposable disposable; disposable.Dispose(); } } }
public X509Name(IList oids, IList values, X509NameEntryConverter converter) { this.converter = converter; if (oids.Count != values.Count) { throw new ArgumentException("'oids' must be same length as 'values'."); } for (int i = 0; i < oids.Count; i++) { this.ordering.Add(oids[i]); this.values.Add(values[i]); this.added.Add(false); } }
public X509Name(IList ordering, IDictionary attributes, X509NameEntryConverter converter) { this.converter = converter; foreach (DerObjectIdentifier derObjectIdentifier in ordering) { object obj = attributes[derObjectIdentifier]; if (obj == null) { throw new ArgumentException("No attribute for object id - " + derObjectIdentifier + " - passed to distinguished name"); } this.ordering.Add(derObjectIdentifier); this.added.Add(false); this.values.Add(obj); } }
public X509Name(global::System.Collections.IList oids, global::System.Collections.IList values, X509NameEntryConverter converter) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) this.converter = converter; if (((global::System.Collections.ICollection)oids).get_Count() != ((global::System.Collections.ICollection)values).get_Count()) { throw new ArgumentException("'oids' must be same length as 'values'."); } for (int i = 0; i < ((global::System.Collections.ICollection)oids).get_Count(); i++) { ordering.Add(oids.get_Item(i)); this.values.Add(values.get_Item(i)); added.Add((object)false); } }
/** * Constructor from a table of attributes with ordering. * <p> * it's is assumed the table contains OID/string pairs, and the contents * of the table are copied into an internal table as part of the * construction process. The ordering ArrayList should contain the OIDs * in the order they are meant to be encoded or printed in ToString.</p> * <p> * The passed in converter will be used to convert the strings into their * ASN.1 counterparts.</p> */ public X509Name( IList ordering, IDictionary attributes, X509NameEntryConverter converter) { this.converter = converter; foreach (DerObjectIdentifier oid in ordering) { object attribute = attributes[oid]; if (attribute == null) { throw new ArgumentException("No attribute for object id - " + oid + " - passed to distinguished name"); } this.ordering.Add(oid); this.added.Add(false); this.values.Add(attribute); // copy the hash table } }
public X509Name(bool reverse, string dirName, X509NameEntryConverter converter) : this(reverse, (IDictionary)(object)DefaultLookup, dirName, converter) { }
public X509Name(bool reverse, IDictionary lookUp, string dirName, X509NameEntryConverter converter) { this.converter = converter; X509NameTokenizer x509NameTokenizer = new X509NameTokenizer(dirName); while (x509NameTokenizer.HasMoreTokens()) { string text = x509NameTokenizer.NextToken(); int num = text.IndexOf('='); if (num == -1) { throw new ArgumentException("badly formated directory string"); } string name = text.Substring(0, num); string text2 = text.Substring(num + 1); DerObjectIdentifier value = this.DecodeOid(name, lookUp); if (text2.IndexOf('+') > 0) { X509NameTokenizer x509NameTokenizer2 = new X509NameTokenizer(text2, '+'); string value2 = x509NameTokenizer2.NextToken(); this.ordering.Add(value); this.values.Add(value2); this.added.Add(false); while (x509NameTokenizer2.HasMoreTokens()) { string text3 = x509NameTokenizer2.NextToken(); int num2 = text3.IndexOf('='); string name2 = text3.Substring(0, num2); string value3 = text3.Substring(num2 + 1); this.ordering.Add(this.DecodeOid(name2, lookUp)); this.values.Add(value3); this.added.Add(true); } } else { this.ordering.Add(value); this.values.Add(text2); this.added.Add(false); } } if (reverse) { IList list = Platform.CreateArrayList(); IList list2 = Platform.CreateArrayList(); IList list3 = Platform.CreateArrayList(); int num3 = 1; for (int i = 0; i < this.ordering.Count; i++) { if (!(bool)this.added[i]) { num3 = 0; } int index = num3++; list.Insert(index, this.ordering[i]); list2.Insert(index, this.values[i]); list3.Insert(index, this.added[i]); } this.ordering = list; this.values = list2; this.added = list3; } }
/** * Constructor from a table of attributes with ordering. * <p> * it's is assumed the table contains OID/string pairs, and the contents * of the table are copied into an internal table as part of the * construction process. The ordering ArrayList should contain the OIDs * in the order they are meant to be encoded or printed in ToString.</p> * <p> * The passed in converter will be used to convert the strings into their * ASN.1 counterparts.</p> */ public X509Name( ArrayList ordering, Hashtable attributes, X509NameEntryConverter converter) { this.converter = converter; foreach (DerObjectIdentifier oid in ordering) { object attribute = attributes[oid]; if (attribute == null) { throw new ArgumentException("No attribute for object id - " + oid + " - passed to distinguished name"); } this.ordering.Add(oid); this.added.Add(false); this.values.Add(attribute); // copy the hash table } }
public X509Name(string dirName, X509NameEntryConverter converter) : this(X509Name.DefaultReverse, X509Name.DefaultLookup, dirName, converter) { }
/** * Takes two vectors one of the oids and the other of the values. * <p> * The passed in converter will be used to convert the strings into their * ASN.1 counterparts.</p> */ public X509Name( ArrayList oids, ArrayList values, X509NameEntryConverter converter) { this.converter = converter; if (oids.Count != values.Count) { throw new ArgumentException("'oids' must be same length as 'values'."); } for (int i = 0; i < oids.Count; i++) { this.ordering.Add(oids[i]); this.values.Add(values[i]); this.added.Add(false); } }
public X509Name(bool reverse, IDictionary lookUp, string dirName, X509NameEntryConverter converter) { this.ordering = Platform.CreateArrayList(); this.values = Platform.CreateArrayList(); this.added = Platform.CreateArrayList(); this.converter = converter; X509NameTokenizer tokenizer = new X509NameTokenizer(dirName); while (tokenizer.HasMoreTokens()) { string str = tokenizer.NextToken(); int index = str.IndexOf('='); if (index == -1) { throw new ArgumentException("badly formated directory string"); } string name = str.Substring(0, index); string oid = str.Substring(index + 1); DerObjectIdentifier identifier = this.DecodeOid(name, lookUp); if (oid.IndexOf('+') > 0) { X509NameTokenizer tokenizer2 = new X509NameTokenizer(oid, '+'); string str4 = tokenizer2.NextToken(); this.ordering.Add(identifier); this.values.Add(str4); this.added.Add(false); while (tokenizer2.HasMoreTokens()) { string str5 = tokenizer2.NextToken(); int length = str5.IndexOf('='); string str6 = str5.Substring(0, length); string str7 = str5.Substring(length + 1); this.ordering.Add(this.DecodeOid(str6, lookUp)); this.values.Add(str7); this.added.Add(true); } } else { this.ordering.Add(identifier); this.values.Add(oid); this.added.Add(false); } } if (reverse) { IList list = Platform.CreateArrayList(); IList list2 = Platform.CreateArrayList(); IList list3 = Platform.CreateArrayList(); int num3 = 1; for (int i = 0; i < this.ordering.Count; i++) { if (!((bool)this.added[i])) { num3 = 0; } int index = num3++; list.Insert(index, this.ordering[i]); list2.Insert(index, this.values[i]); list3.Insert(index, this.added[i]); } this.ordering = list; this.values = list2; this.added = list3; } }
/** * Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or * some such, converting it into an ordered set of name attributes. lookUp * should provide a table of lookups, indexed by lowercase only strings and * yielding a DerObjectIdentifier, other than that OID. and numeric oids * will be processed automatically. The passed in converter is used to convert the * string values to the right of each equals sign to their ASN.1 counterparts. * <br/> * @param reverse true if we should start scanning from the end, false otherwise. * @param lookUp table of names and oids. * @param dirName the string dirName * @param converter the converter to convert string values into their ASN.1 equivalents */ public X509Name( bool reverse, IDictionary lookUp, string dirName, X509NameEntryConverter converter) { this.converter = converter; X509NameTokenizer nTok = new X509NameTokenizer(dirName); while (nTok.HasMoreTokens()) { string token = nTok.NextToken(); int index = token.IndexOf('='); if (index == -1) { throw new ArgumentException("badly formated directory string"); } string name = token.Substring(0, index); string value = token.Substring(index + 1); DerObjectIdentifier oid = DecodeOid(name, lookUp); if (value.IndexOf('+') > 0) { X509NameTokenizer vTok = new X509NameTokenizer(value, '+'); string v = vTok.NextToken(); this.ordering.Add(oid); this.values.Add(v); this.added.Add(false); while (vTok.HasMoreTokens()) { string sv = vTok.NextToken(); int ndx = sv.IndexOf('='); string nm = sv.Substring(0, ndx); string vl = sv.Substring(ndx + 1); this.ordering.Add(DecodeOid(nm, lookUp)); this.values.Add(vl); this.added.Add(true); } } else { this.ordering.Add(oid); this.values.Add(value); this.added.Add(false); } } if (reverse) { // this.ordering.Reverse(); // this.values.Reverse(); // this.added.Reverse(); ArrayList o = new ArrayList(); ArrayList v = new ArrayList(); ArrayList a = new ArrayList(); int count = 1; for (int i = 0; i < this.ordering.Count; i++) { if (!((bool) this.added[i])) { count = 0; } int index = count++; o.Insert(index, this.ordering[i]); v.Insert(index, this.values[i]); a.Insert(index, this.added[i]); } this.ordering = o; this.values = v; this.added = a; } }
/** * Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or * some such, converting it into an ordered set of name attributes. lookUp * should provide a table of lookups, indexed by lowercase only strings and * yielding a DerObjectIdentifier, other than that OID. and numeric oids * will be processed automatically. The passed in converter is used to convert the * string values to the right of each equals sign to their ASN.1 counterparts. * <br/> * @param reverse true if we should start scanning from the end, false otherwise. * @param lookUp table of names and oids. * @param dirName the string dirName * @param converter the converter to convert string values into their ASN.1 equivalents */ public X509Name( bool reverse, IDictionary lookUp, string dirName, X509NameEntryConverter converter) { this.converter = converter; X509NameTokenizer nTok = new X509NameTokenizer(dirName); while (nTok.HasMoreTokens()) { string token = nTok.NextToken(); int index = token.IndexOf('='); if (index == -1) { throw new ArgumentException("badly formated directory string"); } string name = token.Substring(0, index); string value = token.Substring(index + 1); DerObjectIdentifier oid = DecodeOid(name, lookUp); if (value.IndexOf('+') > 0) { X509NameTokenizer vTok = new X509NameTokenizer(value, '+'); string v = vTok.NextToken(); this.ordering.Add(oid); this.values.Add(v); this.added.Add(false); while (vTok.HasMoreTokens()) { string sv = vTok.NextToken(); int ndx = sv.IndexOf('='); string nm = sv.Substring(0, ndx); string vl = sv.Substring(ndx + 1); this.ordering.Add(DecodeOid(nm, lookUp)); this.values.Add(vl); this.added.Add(true); } } else { this.ordering.Add(oid); this.values.Add(value); this.added.Add(false); } } if (reverse) { // this.ordering.Reverse(); // this.values.Reverse(); // this.added.Reverse(); IList o = Platform.CreateArrayList(); IList v = Platform.CreateArrayList(); IList a = Platform.CreateArrayList(); int count = 1; for (int i = 0; i < this.ordering.Count; i++) { if (!((bool)this.added[i])) { count = 0; } int index = count++; o.Insert(index, this.ordering[i]); v.Insert(index, this.values[i]); a.Insert(index, this.added[i]); } this.ordering = o; this.values = v; this.added = a; } }
public X509Name(bool reverse, IDictionary lookUp, string dirName, X509NameEntryConverter converter) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) this.converter = converter; X509NameTokenizer x509NameTokenizer = new X509NameTokenizer(dirName); while (x509NameTokenizer.HasMoreTokens()) { string text = x509NameTokenizer.NextToken(); int num = text.IndexOf('='); if (num == -1) { throw new ArgumentException("badly formated directory string"); } string name = text.Substring(0, num); string text2 = text.Substring(num + 1); DerObjectIdentifier derObjectIdentifier = DecodeOid(name, lookUp); if (text2.IndexOf('+') > 0) { X509NameTokenizer x509NameTokenizer2 = new X509NameTokenizer(text2, '+'); string text3 = x509NameTokenizer2.NextToken(); ordering.Add((object)derObjectIdentifier); values.Add((object)text3); added.Add((object)false); while (x509NameTokenizer2.HasMoreTokens()) { string text4 = x509NameTokenizer2.NextToken(); int num2 = text4.IndexOf('='); string name2 = text4.Substring(0, num2); string text5 = text4.Substring(num2 + 1); ordering.Add((object)DecodeOid(name2, lookUp)); values.Add((object)text5); added.Add((object)true); } } else { ordering.Add((object)derObjectIdentifier); values.Add((object)text2); added.Add((object)false); } } if (!reverse) { return; } global::System.Collections.IList list = Platform.CreateArrayList(); global::System.Collections.IList list2 = Platform.CreateArrayList(); global::System.Collections.IList list3 = Platform.CreateArrayList(); int num3 = 1; for (int i = 0; i < ((global::System.Collections.ICollection)ordering).get_Count(); i++) { if (!(bool)added.get_Item(i)) { num3 = 0; } int num4 = num3++; list.Insert(num4, ordering.get_Item(i)); list2.Insert(num4, values.get_Item(i)); list3.Insert(num4, added.get_Item(i)); } ordering = list; values = list2; added = list3; }