Skip to content

Commit

Permalink
Cleanup dead code / export/import certs
Browse files Browse the repository at this point in the history
  • Loading branch information
PrzemyslawKlys committed May 15, 2024
1 parent 8495d39 commit fd70ae6
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions Sources/Mailozaurr/Smtp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,37 +349,6 @@ public SmtpResult MultipartSign(string certificateThumbprint) {
}
}


//public SmtpResult MultipartSignFromStore(string certificateThumbprint, string pfxPassword) {
// // Load the certificate from the Windows Certificate Store
// X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
// store.Open(OpenFlags.ReadOnly);

// X509Certificate2Collection certificates = store.Certificates.Find(X509FindType.FindByThumbprint, certificateThumbprint, false);

// store.Close();

// if (certificates.Count > 0) {
// // Export the certificate to a PFX file
// byte[] pfxData = certificates[0].Export(X509ContentType.Pfx, pfxPassword);

// // Import the certificate from the PFX data
// X509Certificate2 certificate = new X509Certificate2(pfxData, pfxPassword, X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet);

// // Sign the email with the certificate
// //using (var ctx = new DefaultSecureMimeContext()) {
// // var signer = new CmsSigner(certificate) {
// // DigestAlgorithm = DigestAlgorithm.Sha1
// // };
// // Message.Body = MultipartSigned.Create(ctx, signer, Message.Body);
// //}
// return MultipartSign(certificate);
// } else {
// throw new Exception("Certificate not found in the store.");
// }
//}


public void Pkcs7Sign(string pfxFilePath, string password) {
X509Certificate2 certificate = new X509Certificate2(pfxFilePath, password, X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet);
Pkcs7Sign(certificate);
Expand Down

0 comments on commit fd70ae6

Please sign in to comment.