private void AddFileToCollection(string path) { int i; string key; byte[] raw = EstEIDUtils.ReadFile(path); X509Certificate[] chain = X509Utils.LoadCertificate(raw); for (i = 0; i < chain.Length; i++) { key = X509Utils.GetSubjectFields(chain[i], "CN"); // better safe than sorry, who knows what the dir content consists of... if (!certs.Contains(key)) { certs.Add(key, new X509CertStoreEntry(path, chain[i])); } } }
static public Org.BouncyCastle.X509.X509Certificate[] LoadCertificate(string path) { byte[] raw = EstEIDUtils.ReadFile(path); return(LoadCertificate(raw)); }