Beispiel #1
0
        public void ReadTest()
        {
            Dictionary <string, X509Certificate2> certs = new Dictionary <string, X509Certificate2>();
            string crlfpath = Path.GetFullPath("CABundle-CRLF.txt");

            CABundle.Read(crlfpath, certs);
            Assert.IsTrue(certs.Count == 2, "Did not read 2 certs from CRLF bundle");

            certs.Clear();
            string lfpath = Path.GetFullPath("CABundle-LF.txt");

            CABundle.Read(lfpath, certs);
            Assert.IsTrue(certs.Count == 2, "Did not read 2 certs from LF bundle");
        }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = URL?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ InsecureSkipTLSVerify.GetHashCode();
         hashCode = (hashCode * 397) ^ (CABundle?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)RelistBehavior;
         hashCode = (hashCode * 397) ^ RelistDuration.GetHashCode();
         hashCode = (hashCode * 397) ^ RelistRequests.GetHashCode();
         hashCode = (hashCode * 397) ^ (CatalogRestrictions?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (AuthInfo?.GetHashCode() ?? 0);
         return(hashCode);
     }
 }
Beispiel #3
0
        public void WriteTest()
        {
            Dictionary <string, X509Certificate2> certs = new Dictionary <string, X509Certificate2>();
            string crlfpath = Path.GetFullPath("CABundle-CRLF.txt");

            CABundle.Read(crlfpath, certs);

            string newpath   = Directory.GetParent(crlfpath).FullName;
            string newbundle = Path.Combine(newpath, "CABundle-new.txt");

            CABundle.Write(newbundle, certs);

            certs.Clear();
            CABundle.Read(newbundle, certs);
            Assert.IsTrue(certs.Count == 2, "Did not read 2 certs from new bundle");
        }