Exemple #1
0
        public void CertificateGeneratorForSmartCard(X509Certificate x509certificate)
        {
            SmartCardHandler smartCardHandler = new SmartCardHandler();

            Session smartCardSession = null;
            {
                smartCardHandler.Start(out smartCardSession);

                smartCardHandler.ImportCertificateToSmartCard(smartCardSession, x509certificate);

                smartCardHandler.Destroy(smartCardSession);
            }
        }
Exemple #2
0
        private void GenerateKeyPair()
        {
            SmartCardHandler smartCardHandler = new SmartCardHandler();

            ObjectHandle publicKey        = null;
            ObjectHandle privateKey       = null;
            Session      smartCardSession = null;
            {
                smartCardHandler.Start(out smartCardSession);
                smartCardHandler.KeyPairGenerator(smartCardSession, out publicKey, out privateKey);
                smartCardHandler.Destroy(smartCardSession, publicKey, privateKey);
            }
        }
Exemple #3
0
        private ObjectHandle WritePrivateKeyToSmartCard(AsymmetricCipherKeyPair asymmetricCipherKeyPair, EnrollementDTO enrollmentDTO)
        {
            Pkcs1xHandler    pkcs1xHandler    = new Pkcs1xHandler();
            SmartCardHandler smartCardHandler = new SmartCardHandler();
            ObjectHandle     objectHandle;

            Session smartCardSession = null;

            {
                smartCardHandler.Start(out smartCardSession);

                objectHandle = smartCardHandler.ImportPrivateKeyToSmartCard(smartCardSession, asymmetricCipherKeyPair, enrollmentDTO.ID);

                smartCardHandler.Destroy(smartCardSession);
            }

            return(objectHandle);
        }