/** * Constructs an X509 name * @param dirName a directory name */ public X509Name(String dirName) { X509NameTokenizer nTok = new X509NameTokenizer(dirName); while (nTok.HasMoreTokens()) { String token = nTok.NextToken(); int index = token.IndexOf('='); if (index == -1) { throw new ArgumentException(MessageLocalization.GetComposedMessage("badly.formated.directory.string")); } String id = token.Substring(0, index).ToUpper(System.Globalization.CultureInfo.InvariantCulture); String value = token.Substring(index + 1); List <string> vs; if (!values.TryGetValue(id, out vs)) { vs = new List <string>(); values[id] = vs; } vs.Add(value); } }
private static IEnumerable <string> Tokenize(string issuer) { var tokenizer = new X509NameTokenizer(issuer); while (tokenizer.HasMoreTokens()) { yield return(tokenizer.NextToken()); } }
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 = DecodeOid(name, lookUp); if (text2.IndexOf('+') > 0) { X509NameTokenizer x509NameTokenizer2 = new X509NameTokenizer(text2, '+'); string value2 = x509NameTokenizer2.NextToken(); ordering.Add(value); values.Add(value2); 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); ordering.Add(DecodeOid(name2, lookUp)); values.Add(value3); added.Add(true); } } else { ordering.Add(value); values.Add(text2); added.Add(false); } } if (!reverse) { return; } IList list = Platform.CreateArrayList(); IList list2 = Platform.CreateArrayList(); IList list3 = Platform.CreateArrayList(); int num3 = 1; for (int i = 0; i < ordering.Count; i++) { if (!(bool)added[i]) { num3 = 0; } int index = num3++; list.Insert(index, ordering[i]); list2.Insert(index, values[i]); list3.Insert(index, added[i]); } ordering = list; values = list2; added = list3; }
/** * Constructs an X509 name * @param dirName a directory name */ public X509Name(String dirName) { X509NameTokenizer nTok = new X509NameTokenizer(dirName); while (nTok.HasMoreTokens()) { String token = nTok.NextToken(); int index = token.IndexOf('='); if (index == -1) { throw new ArgumentException(MessageLocalization.GetComposedMessage("badly.formated.directory.string")); } String id = token.Substring(0, index).ToUpper(System.Globalization.CultureInfo.InvariantCulture); String value = token.Substring(index + 1); List<string> vs; if (!values.TryGetValue(id, out vs)) { vs = new List<string>(); values[id] = vs; } vs.Add(value); } }
/** * Constructs an X509 name * @param dirName a directory name */ public X509Name(String dirName) { 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 id = token.Substring(0, index).ToUpper(); String value = token.Substring(index + 1); ArrayList vs = (ArrayList)values[id]; if (vs == null) { vs = new ArrayList(); values[id] = vs; } vs.Add(value); } }