public void CertificateGeneratorForSmartCard(X509Certificate x509certificate) { SmartCardHandler smartCardHandler = new SmartCardHandler(); Session smartCardSession = null; { smartCardHandler.Start(out smartCardSession); smartCardHandler.ImportCertificateToSmartCard(smartCardSession, x509certificate); smartCardHandler.Destroy(smartCardSession); } }
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); } }
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); }