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

Where is the Public Key in the .NET RSA encryption

关于这个样本:https://msdn.microsoft.com/en-us/library/system.security.cryptography.rsacryptoserviceprovider(v=vs.110).aspx

在此示例中,用于加密数据的 public 密钥在哪里?

它在 RSAParameters 对象中吗?

如果是,什么是正确的字节数组来对其进行 base64 编码并将字符串放入 web.config 以在我必须解密以前加密的数据时重新使用 public 密钥?

如果您阅读了您提供 link 的文章,那么您会看到该示例说

    //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);

不确定您对 Public 密钥加密的理解程度,但您使用 public 密钥加密数据并使用私钥解密数据,因此您需要确保私钥安全存储, 配置文件不安全

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