コード例 #1
0
ファイル: Handler.cs プロジェクト: khabib97/bcc-ca-client
        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);
        }
コード例 #2
0
ファイル: Handler.cs プロジェクト: khabib97/bcc-ca-client
        public void CertificateGenerator(long serverGeneratedEnrollmentID, int KeyStore)
        {
            String          stringifyCertificate = new NetworkHandler().GetCertificateByteArray(serverGeneratedEnrollmentID);
            X509Certificate x509certificate      = new Pkcs1xHandler().GenerateCertificate(stringifyCertificate);

            switch (KeyStore)
            {
            case Constants.KeyStore.SMART_CARD:
            {
                CertificateGeneratorForSmartCard(x509certificate);
            }
            break;

            case Constants.KeyStore.WINDOWS:
            {
                CertificateGeneratorForWindowsKeystore(x509certificate, serverGeneratedEnrollmentID);
            }
            break;
            }
            Console.WriteLine("Certificate Writing: Done Successfully");
        }