docs: 完善文档

This commit is contained in:
Fu Diwei
2022-05-09 20:31:03 +08:00
parent a0a90f4851
commit 9bf9d0c979
23 changed files with 405 additions and 35 deletions

View File

@@ -21,10 +21,10 @@
开发者利用本库提供的 `RSAUtility``AESUtility` 工具类自行解密相关字段。下面给出一个使用 `RSAUtility` 工具类解密数据的示例代码:
```csharp
string chiperText = "待解密的数据";
string cipherText = "待解密的数据";
string privateKey = "PKCS#8 私钥内容";
/* 通过私钥解密数据 */
string plainText = RSAUtility.DecryptWithECB(privateKey, chiperText);
string plainText = RSAUtility.DecryptWithECB(privateKey, cipherText);
```
此外,本库还封装了直接解密响应中敏感信息字段的扩展方法,下面给出一个示例代码:
@@ -33,12 +33,12 @@ string plainText = RSAUtility.DecryptWithECB(privateKey, chiperText);
var request = new Models.QueryCertificatesRequest();
var response = await client.ExecuteQueryCertificatesAsync(request);
string temp = response.CertificateList.First().EncryptCertificate.CipherText; // 此时仍是密文
Console.WriteLine("before: {0}", response.CertificateList.First().EncryptCertificate.CipherText); // 此时仍是密文
client.DecryptResponseSensitiveProperty(response);
string temp = response.CertificateList.First().EncryptCertificate.CipherText; // 此时已是明文
Console.WriteLine("after: {0}", response.CertificateList.First().EncryptCertificate.CipherText); // 此时已是明文
```
如果你希望本库在响应后能自动完成这项操作,你可以在构造得到 `WechatApiClient` 对象时指定自动化参数:
如果你希望本库在响应后能自动完成这项操作,你可以在构造得到 `WechatTenpayClient` 对象时指定自动化参数:
```csharp
var options = new WechatTenpayClientOptions()