# RSAParameters 结构

## 定义

``public value class RSAParameters``
``public struct RSAParameters``
``````[System.Serializable]
public struct RSAParameters``````
``````[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public struct RSAParameters``````
``type RSAParameters = struct``
``Public Structure RSAParameters``

RSAParameters

## 注解

RSA 类公开了一种 ExportParameters 方法，该方法使你能够以 RSAParameters 结构的形式检索原始 RSA 密钥。The RSA class exposes an ExportParameters method that enables you to retrieve the raw RSA key in the form of an RSAParameters structure. 了解此结构的内容需要熟悉 RSA 算法的工作原理。Understanding the contents of this structure requires familiarity with how the RSA algorithm works. 下一节将简要讨论该算法。The next section discusses the algorithm briefly.

### 字段摘要Summary of Fields

RSAParameters field 包含Contains 对应的 PKCS #1 字段Corresponding PKCS #1 field
D d. 专用指数d, the private exponent privateExponentprivateExponent
DP d mod （第1项）d mod (p - 1) exponent1exponent1
DQ d mod （q-1）d mod (q - 1) exponent2exponent2
Exponent e，公共指数e, the public exponent publicExponentpublicExponent
InverseQ (InverseQ)（q） = 1 mod p(InverseQ)(q) = 1 mod p 系数coefficient
Modulus nn modulusmodulus
P pp prime1prime1
Q qq prime2prime2

RSA 的安全性派生于这样一个事实：在给定公钥 {e，n} 的情况下，不能计算 d （直接或通过将 n 分解为 p 和 q）来计算 d。The security of RSA derives from the fact that, given the public key { e, n }, it is computationally infeasible to calculate d, either directly or by factoring n into p and q. 因此，与 d、p 或 q 相关的密钥的任何部分都必须保持机密。Therefore, any part of the key related to d, p, or q must be kept secret. 如果调用If you call

ExportParameters，只要求提供公钥信息，这就是为什么只接收 ExponentModulus的原因。ExportParameters and ask for only the public key information, this is why you will receive only Exponent and Modulus. 仅当你有权访问私钥并请求它时，其他字段才可用。The other fields are available only if you have access to the private key, and you request it.

.Net Core 2.1.0 及更高版本：已删除序列化限制，并对 RSAParameters 的所有成员进行序列化。.NET Core 2.1.0 and later: The serialization restrictions have been removed and all members of RSAParameters are serialized. 对 .NET Core 2.1.0 或更高版本的代码进行编写或升级时，必须 excercised，因为如果任何人都可以派生或截取私钥参数，密钥和所有加密或签名的信息都将受到威胁。Care must be excercised when writing or upgrading code against .NET Core 2.1.0 or later, because if anyone can derive or intercept the private key parameters the key and all the information encrypted or signed with it are compromised.

## 字段

 表示 RSA 算法的 `D` 参数。Represents the `D` parameter for the RSA algorithm. 表示 RSA 算法的 `DP` 参数。Represents the `DP` parameter for the RSA algorithm. 表示 RSA 算法的 `DQ` 参数。Represents the `DQ` parameter for the RSA algorithm. 表示 RSA 算法的 `Exponent` 参数。Represents the `Exponent` parameter for the RSA algorithm. 表示 RSA 算法的 `InverseQ` 参数。Represents the `InverseQ` parameter for the RSA algorithm. 表示 RSA 算法的 `Modulus` 参数。Represents the `Modulus` parameter for the RSA algorithm. 表示 RSA 算法的 `P` 参数。Represents the `P` parameter for the RSA algorithm. 表示 RSA 算法的 `Q` 参数。Represents the `Q` parameter for the RSA algorithm.