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); }
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"); }