我在我的项目中使用下面的代码进行加密,一切正常。
RSACryptoServiceProvider x_alg = new RSACryptoServiceProvider( );
// export only the public key
RSAParameters x_public_params = x_alg.ExportParameters(false);
// export the private key
RSAParameters x_private_params = x_alg.ExportParameters(true);
现在客户更改了要求,他想将所有 RSAParameters 值存储到配置文件中,并提供以下详细信息以进行演示
<project name="netCard Server1">
<key length="256"></key>
<D length="64">00000000000000000000000000000000000000000000000000000000000019C5</D>
<DP length="32">00000000000000000000000000000061</DP>
<DQ length="32">00000000000000000000000000000065</DQ>
<Exponent length="6">000DCD</Exponent>
<InverseQ length="32">0000000000000000000000000000003B</InverseQ>
<Modulus length="64">0000000000000000000000000000000000000000000000000000000000002C95</Modulus>
<P length="32">00000000000000000000000000000065</P>
<Q length="32">00000000000000000000000000000071</Q>
<text length ="64">0123456789ABCDEF111111111111111125FE2222222222222233333333334444</text>
<cipher length ="64">0000000000000000000000000000000000000000000000000000000000000000</cipher>
</project>
现在,问题是当我导入 RSAParameters 值时,我得到了 Bad Data Exception