简体   繁体   English

如何使用C#在电子邮件应用程序(mailkit和mimekit)中存储和读取数据库中的数字证书?

[英]How to store and read Digital Certificates in database using C# for email application (mailkit and mimekit)?

I m making an application which requires sending encrypted and digitally signed email for which I want to use S/MIME. 我正在制作一个应用程序,该应用程序需要发送要使用S / MIME的加密且经过数字签名的电子邮件 I am using the MAILKIT and MIMEKIT API. 我正在使用MAILKITMIMEKIT API。 However, the MIMEKIT requires the certificates to be loaded from a sql database. 但是,MIMEKIT要求从sql数据库中加载证书。 As shown below 如下所示

public MySecureMimeContext()
    : base(OpenDatabase("C:\\wherever\\certdb.sqlite"))
{
}

I have got certificates with me (Root CA and Client Certificates (pfx files), but how can I save and read them from a database ? Or is there an alternative simple approach ? 我已经获得了证书(根CA和客户端证书(pfx文件),但是如何保存和从数据库中读取它们呢?还是有另一种简单的方法?

The DefaultSecureMimeContext that your class presumably inherits from has a number of Import() methods that you can use: 您的类可能继承自的DefaultSecureMimeContext具有许多可以使用的Import()方法:

http://www.mimekit.net/docs/html/Overload_MimeKit_Cryptography_DefaultSecureMimeContext_Import.htm http://www.mimekit.net/docs/html/Overload_MimeKit_Cryptography_DefaultSecureMimeContext_Import.htm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM