Пример #1
0
        public void ReadCertificateTest()
        {
            String[] readers = EidReader.Readers;
            if (readers.Length != 1)
            {
                Assert.Inconclusive("Can't select a reader, " + readers.Length + " present: " + String.Join(", ", readers));
            }

            EidReader target = new EidReader(readers[0]);

            using (target)
            {
                target.CardAction += new EventHandler <DeviceEventArgs>(target_CardAction);
                target.Connect();

                X509Certificate2 auth = target.ReadCertificate(Certificate.Authentication);
                X509Certificate2 sign = target.ReadCertificate(Certificate.Signature);
                X509Certificate2 ca   = target.ReadCertificate(Certificate.CA);
                X509Certificate2 root = target.ReadCertificate(Certificate.Root);

                Assert.AreNotEqual(auth.Subject, sign.Subject);
                Assert.AreEqual(sign.Issuer, ca.Subject);
                Assert.AreEqual(auth.Issuer, ca.Subject);
                Assert.AreEqual(ca.Issuer, root.Subject);
                Assert.AreEqual(root.Issuer, root.Subject);
            }
        }
Пример #2
0
        public void CardChangeTest()
        {
            EidReader target = new EidReader("ACS CCID USB Reader 0");

            using (target)
            {
                target.CardAction   += new EventHandler <DeviceEventArgs>(target_CardAction);
                target.ReaderAction += new EventHandler <DeviceEventArgs>(target_ReaderAction);

                //Wait for 2 events...
                waitChange.WaitOne(new TimeSpan(0, 1, 0));
                waitChange.WaitOne(new TimeSpan(0, 1, 0));
            }
        }