问题描述
我正在使用公钥和私钥对X509证书加密文件,并将其发送到远程服务器。我该怎么做?这是甚么可能吗?如何生成证书,然后生成公钥和私钥对?
I am looking to encrypt files with X509 certificates using public and private keys and send them to a remote server. How would I do this? Is this even possible? How do I generate the certificate and then the public and private key pairs?
推荐答案
请参阅如何创建一个从加密和解密文件。
See this SO question how to create a RSACryptoServiceProvider
from a X509Certificate2
that can be used to encrypt and decrypt files.
.NET框架不包含生成X.509证书的类。 Mono的( Mono.Security.X509
)和支持从C#创建X.509证书。或者,您可以使用OpenSSL或生成证书。
The .NET framework does not contain classes to generate X.509 certificates. Mono's security classes (Mono.Security.X509
) and BouncyCastle support the creation of X.509 certificates from C#. Alternatively, you can use tools like OpenSSL or makecert.exe
to generate certificates.
这篇关于如何使用X509证书和C#进行非对称加密?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!