Exemplo n.º 1
0
        private string FindSigningCertificateId(string tokenPin, string certificateLabel)
        {
            var signingSlot = SmartCardUtils.SaferFindSlot(this.pkcsLibPath, this.tokenLabel);

            if (signingSlot == null)
            {
                throw new InvalidOperationException("No Smart Card was found.");
            }
            using (var session = PkcsSession.StartNewSession(signingSlot, tokenPin))
            {
                return(SmartCardUtils.FindSigningCertificateId(session, certificateLabel));
            }
        }
Exemplo n.º 2
0
        public void FindSigningCertificate()
        {
            var slot = SmartCardUtils.SaferFindSlot(@"C:\Program Files (x86)\EAC MW klient\pkcs11_x86.dll", "Sig_ZEP");

            using (var session = PkcsSession.StartNewSession(slot, "200860"))
            {
                var signingCertificate = SmartCardUtils.FindSigningCertificate(session, "Certifikat k podpisovemu klucu");
                Assert.IsNotNull(signingCertificate);

                var certificateChain = SmartCardUtils.GetCertificateChain(signingCertificate);
                Assert.IsNotEmpty(certificateChain);
            }
        }