How to do asymmetric encryption with X509 certificates and C#?

蹲街弑〆低调 提交于 2019-12-24 04:54:29

问题


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?


回答1:


See this SO question how to create a RSACryptoServiceProvider from a X509Certificate2 that can be used to encrypt and decrypt files.

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.



来源:https://stackoverflow.com/questions/1776236/how-to-do-asymmetric-encryption-with-x509-certificates-and-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!