简体   繁体   English

.NET RSA加密中的公钥在哪里

[英]Where is the Public Key in the .NET RSA encryption

Regarding this sample: https://msdn.microsoft.com/en-us/library/system.security.cryptography.rsacryptoserviceprovider(v=vs.110).aspx 关于此示例: https : //msdn.microsoft.com/zh-cn/library/system.security.cryptography.rsacryptoserviceprovider(v=vs.110).aspx

Where in this sample is the public key used to encrypt the data? 在此样本中,用于加密数据的公钥在哪里?

Is it inside the RSAParameters object? 它在RSAParameters对象内吗?

If yes what is the correct byte array to base64encode it and put the string into a web.config to re-use the public key when I have to decrypt the formerly encrypted data? 如果是,什么是对base64进行编码的正确字节数组,然后在必须解密以前加密的数据时将字符串放入web.config中以重新使用公钥?

if you read the article you provided the link to then you will see the example says 如果您阅读了提供链接的文章,那么您将看到示例说

    //Export the key information to an RSAParameters object.
    //Pass false to export the public key information or pass
    //true to export public and private key information.
    RSAParameters RSAParams = RSA.ExportParameters(false);

not sure how well you understand Public Key encyption but you use the public key to encrypt data and the private key to decrypt it so you need to ensure that the private key is stored securely, config files are not secure 不确定您对公钥加密的理解程度如何,但是您使用公钥加密数据,并使用私钥解密数据,因此需要确保私钥安全存储,配置文件不安全

you can read about the parameters here https://msdn.microsoft.com/en-gb/library/system.security.cryptography.rsaparameters%28v=vs.110%29.aspx 您可以在此处阅读有关参数的信息https://msdn.microsoft.com/zh-CN/library/system.security.cryptography.rsaparameters%28v=vs.110%29.aspx

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

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