如何使用X509证书和C#进行非对称加密? [英] How to do asymmetric encryption with X509 certificates and C#?

查看:301
本文介绍了如何使用X509证书和C#进行非对称加密?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用公钥和私钥对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?

推荐答案

请参阅这个问题如何创建一个 RSACryptoServiceProvider X509Certificate2 加密和解密文件。

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 )和 BouncyCastle 支持从C#创建X.509证书。或者,您可以使用OpenSSL或 makecert.exe这样的工具 生成证书。

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#进行非对称加密?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆