我在我的項目中使用下面的代碼進行加密,一切工作正常。我如何在c#中填寫RSAParameters值?
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">ABCDEF111111111111111125FE2222222222222233333333334444</text>
<cipher length ="64">0000000000000000000000000000000000000000000000000000000000000000</cipher>
</project>
,問題是,當我導入RSAParameters值,我得到錯誤數據異常
只需使用RSACryptoServiceProvider直接創建您自己的RSA密鑰對,然後使用和不使用私鑰導出參數。現在將該輸出與上述內容進行比較以查看差異。 –