diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Constants/EncryptionAlgorithms.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Constants/EncryptionAlgorithms.cs index b184dc51..441e7d91 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Constants/EncryptionAlgorithms.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Constants/EncryptionAlgorithms.cs @@ -4,6 +4,8 @@ { public const string AEAD_AES_256_GCM = "AEAD_AES_256_GCM"; - public const string RSA_2048_PKCS8_ECB = "RSA_2048_PKCS8_ECB"; + public const string RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1 = "RSA_2048_ECB_PKCS8_OAEPWithSHA-1AndMGF1"; + + public const string RSA_2048_ECB_PKCS1 = "RSA_2048_ECB_PKCS1"; } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientRequestEncryptionExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientRequestEncryptionExtensions.cs index f156fee1..a0f8b4a7 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientRequestEncryptionExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientRequestEncryptionExtensions.cs @@ -33,7 +33,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3 if (attr == null) return (false, oldValue); - if (Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB.Equals(attr.Algorithm)) + if (Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1.Equals(attr.Algorithm) || + Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS1.Equals(attr.Algorithm)) { if (client.PlatformCertificateManager == null) throw new Exceptions.WechatTenpayRequestEncryptionException("Encrypt request failed, because there is no platform certificate in the manager."); @@ -65,10 +66,23 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3 request.WechatpayCertificateSerialNumber = cert.SerialNumber; } - string newValue = Utilities.RSAUtility.EncryptWithECBByCertificate( - certificate: certificate, - plainText: oldValue - ); + string newValue = oldValue; + if (Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1.Equals(attr.Algorithm)) + { + newValue = Utilities.RSAUtility.EncryptWithECBByCertificate( + certificate: certificate, + plainText: oldValue + ); + } + else if(Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS1.Equals(attr.Algorithm)) + { + newValue = Utilities.RSAUtility.EncryptWithECBByCertificate( + certificate: certificate, + plainText: oldValue, + paddingAlgorithm: "PKCS1PADDING" + ); + } + return (true, newValue); } else diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientResponseDecryptionExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientResponseDecryptionExtensions.cs index 946b8dd9..3b3d9634 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientResponseDecryptionExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientResponseDecryptionExtensions.cs @@ -65,12 +65,26 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3 if (attr == null) return (false, oldValue); - if (Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB.Equals(attr.Algorithm)) + if (Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1.Equals(attr.Algorithm) || + Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS1.Equals(attr.Algorithm)) { - string newValue = Utilities.RSAUtility.DecryptWithECB( - privateKey: client.Credentials.MerchantCertificatePrivateKey, - cipherText: oldValue - ); + string newValue = oldValue; + if (Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1.Equals(attr.Algorithm)) + { + newValue = Utilities.RSAUtility.DecryptWithECB( + privateKey: client.Credentials.MerchantCertificatePrivateKey, + cipherText: oldValue + ); + } + else if (Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS1.Equals(attr.Algorithm)) + { + newValue = Utilities.RSAUtility.DecryptWithECB( + privateKey: client.Credentials.MerchantCertificatePrivateKey, + cipherText: oldValue, + paddingAlgorithm: "PKCS1PADDING" + ); + } + return (true, newValue); } else diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/CreateApplyForSubMerchantApplymentRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/CreateApplyForSubMerchantApplymentRequest.cs index 89d8a95c..b0f1206c 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/CreateApplyForSubMerchantApplymentRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/CreateApplyForSubMerchantApplymentRequest.cs @@ -18,7 +18,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("contact_name")] [System.Text.Json.Serialization.JsonPropertyName("contact_name")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string Name { get; set; } = string.Empty; /// @@ -26,7 +26,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("mobile_phone")] [System.Text.Json.Serialization.JsonPropertyName("mobile_phone")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string Mobile { get; set; } = string.Empty; /// @@ -34,7 +34,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("contact_id_number")] [System.Text.Json.Serialization.JsonPropertyName("contact_id_number")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string? IdCardNumber { get; set; } /// @@ -49,7 +49,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("contact_email")] [System.Text.Json.Serialization.JsonPropertyName("contact_email")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string Email { get; set; } = string.Empty; } @@ -203,7 +203,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("id_card_name")] [System.Text.Json.Serialization.JsonPropertyName("id_card_name")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string IdCardName { get; set; } = string.Empty; /// @@ -211,7 +211,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("id_card_number")] [System.Text.Json.Serialization.JsonPropertyName("id_card_number")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string IdCardNumber { get; set; } = string.Empty; /// @@ -243,7 +243,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("id_doc_name")] [System.Text.Json.Serialization.JsonPropertyName("id_doc_name")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string IdDocumentName { get; set; } = string.Empty; /// @@ -251,7 +251,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("id_doc_number")] [System.Text.Json.Serialization.JsonPropertyName("id_doc_number")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string IdDocumentNumber { get; set; } = string.Empty; /// @@ -334,7 +334,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("name")] [System.Text.Json.Serialization.JsonPropertyName("name")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string Name { get; set; } = string.Empty; /// @@ -342,7 +342,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("id_number")] [System.Text.Json.Serialization.JsonPropertyName("id_number")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string IdNumber { get; set; } = string.Empty; /// @@ -719,7 +719,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("account_name")] [System.Text.Json.Serialization.JsonPropertyName("account_name")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string AccountName { get; set; } = string.Empty; /// @@ -727,7 +727,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("account_number")] [System.Text.Json.Serialization.JsonPropertyName("account_number")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string AccountNumber { get; set; } = string.Empty; /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/Settlement/ModifyApplyForSubMerchantSettlementRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/Settlement/ModifyApplyForSubMerchantSettlementRequest.cs index a7c5eb4b..e7297e96 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/Settlement/ModifyApplyForSubMerchantSettlementRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/Settlement/ModifyApplyForSubMerchantSettlementRequest.cs @@ -25,7 +25,7 @@ /// [Newtonsoft.Json.JsonProperty("account_number")] [System.Text.Json.Serialization.JsonPropertyName("account_number")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string AccountNumber { get; set; } = string.Empty; /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4Subject/CreateApplyForSubjectApplymentRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4Subject/CreateApplyForSubjectApplymentRequest.cs index ed0cc899..5072d91a 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4Subject/CreateApplyForSubjectApplymentRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4Subject/CreateApplyForSubjectApplymentRequest.cs @@ -17,7 +17,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("name")] [System.Text.Json.Serialization.JsonPropertyName("name")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string Name { get; set; } = string.Empty; /// @@ -25,7 +25,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("mobile")] [System.Text.Json.Serialization.JsonPropertyName("mobile")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string Mobile { get; set; } = string.Empty; /// @@ -33,7 +33,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("id_card_number")] [System.Text.Json.Serialization.JsonPropertyName("id_card_number")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string IdCardNumber { get; set; } = string.Empty; } @@ -258,7 +258,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("identification_name")] [System.Text.Json.Serialization.JsonPropertyName("identification_name")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string IdentificationName { get; set; } = string.Empty; /// @@ -266,7 +266,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("identification_number")] [System.Text.Json.Serialization.JsonPropertyName("identification_number")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string IdentificationNumber { get; set; } = string.Empty; /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Bill/GetBillSubMerchantFundflowBillResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Bill/GetBillSubMerchantFundflowBillResponse.cs index 19fb50ea..28fad2dc 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Bill/GetBillSubMerchantFundflowBillResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Bill/GetBillSubMerchantFundflowBillResponse.cs @@ -43,7 +43,7 @@ /// [Newtonsoft.Json.JsonProperty("encrypt_key")] [System.Text.Json.Serialization.JsonPropertyName("encrypt_key")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string EncryptKey { get; set; } = default!; /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/BrandProfitSharing/CreateBrandProfitSharingOrderRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/BrandProfitSharing/CreateBrandProfitSharingOrderRequest.cs index e099375a..a4347d11 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/BrandProfitSharing/CreateBrandProfitSharingOrderRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/BrandProfitSharing/CreateBrandProfitSharingOrderRequest.cs @@ -31,7 +31,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("name")] [System.Text.Json.Serialization.JsonPropertyName("name")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string? Name { get; set; } /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Capital/Banks/QueryCapitalBanksByBankAccountRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Capital/Banks/QueryCapitalBanksByBankAccountRequest.cs index 23e890e0..4305873f 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Capital/Banks/QueryCapitalBanksByBankAccountRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Capital/Banks/QueryCapitalBanksByBankAccountRequest.cs @@ -11,7 +11,7 @@ /// [Newtonsoft.Json.JsonIgnore] [System.Text.Json.Serialization.JsonIgnore] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string AccountNumber { get; set; } = string.Empty; } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/EcommerceApplyments/CreateEcommerceApplymentRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/EcommerceApplyments/CreateEcommerceApplymentRequest.cs index faf89e24..50f080d6 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/EcommerceApplyments/CreateEcommerceApplymentRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/EcommerceApplyments/CreateEcommerceApplymentRequest.cs @@ -100,7 +100,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("id_card_name")] [System.Text.Json.Serialization.JsonPropertyName("id_card_name")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string IdCardName { get; set; } = string.Empty; /// @@ -108,7 +108,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("id_card_number")] [System.Text.Json.Serialization.JsonPropertyName("id_card_number")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string IdCardNumber { get; set; } = string.Empty; /// @@ -133,7 +133,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("id_doc_name")] [System.Text.Json.Serialization.JsonPropertyName("id_doc_name")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string IdDocumentName { get; set; } = string.Empty; /// @@ -141,7 +141,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("id_doc_number")] [System.Text.Json.Serialization.JsonPropertyName("id_doc_number")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string IdDocumentNumber { get; set; } = string.Empty; /// @@ -166,7 +166,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("contact_name")] [System.Text.Json.Serialization.JsonPropertyName("contact_name")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string ContactName { get; set; } = string.Empty; /// @@ -174,7 +174,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("mobile_phone")] [System.Text.Json.Serialization.JsonPropertyName("mobile_phone")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string ContactMobile { get; set; } = string.Empty; /// @@ -182,7 +182,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("contact_id_card_number")] [System.Text.Json.Serialization.JsonPropertyName("contact_id_card_number")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string ContactIdCardNumber { get; set; } = string.Empty; /// @@ -190,7 +190,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("contact_email")] [System.Text.Json.Serialization.JsonPropertyName("contact_email")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string ContactEmail { get; set; } = string.Empty; } @@ -208,7 +208,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("account_name")] [System.Text.Json.Serialization.JsonPropertyName("account_name")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string AccountName { get; set; } = string.Empty; /// @@ -216,7 +216,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("account_number")] [System.Text.Json.Serialization.JsonPropertyName("account_number")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string AccountNumber { get; set; } = string.Empty; /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/EcommerceApplyments/GetEcommerceApplymentByOutRequestNumberResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/EcommerceApplyments/GetEcommerceApplymentByOutRequestNumberResponse.cs index b4a2ad2d..859cb86b 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/EcommerceApplyments/GetEcommerceApplymentByOutRequestNumberResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/EcommerceApplyments/GetEcommerceApplymentByOutRequestNumberResponse.cs @@ -17,7 +17,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("account_name")] [System.Text.Json.Serialization.JsonPropertyName("account_name")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string AccountName { get; set; } = default!; /// @@ -25,7 +25,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("account_no")] [System.Text.Json.Serialization.JsonPropertyName("account_no")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string? AccountNumber { get; set; } /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/EcommerceBill/GetEcommerceBillFundflowBillResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/EcommerceBill/GetEcommerceBillFundflowBillResponse.cs index 3e353dd2..50eacb0c 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/EcommerceBill/GetEcommerceBillFundflowBillResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/EcommerceBill/GetEcommerceBillFundflowBillResponse.cs @@ -43,7 +43,7 @@ /// [Newtonsoft.Json.JsonProperty("encrypt_key")] [System.Text.Json.Serialization.JsonPropertyName("encrypt_key")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string EncryptKey { get; set; } = default!; /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/EcommerceProfitSharing/CreateEcommerceProfitSharingOrderRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/EcommerceProfitSharing/CreateEcommerceProfitSharingOrderRequest.cs index 3cdb6ab5..8cbdf492 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/EcommerceProfitSharing/CreateEcommerceProfitSharingOrderRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/EcommerceProfitSharing/CreateEcommerceProfitSharingOrderRequest.cs @@ -31,7 +31,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("receiver_name")] [System.Text.Json.Serialization.JsonPropertyName("receiver_name")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string? Name { get; set; } /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/EcommerceProfitSharing/Receivers/AddEcommerceProfitSharingReceiverRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/EcommerceProfitSharing/Receivers/AddEcommerceProfitSharingReceiverRequest.cs index c6e25783..389aa1c3 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/EcommerceProfitSharing/Receivers/AddEcommerceProfitSharingReceiverRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/EcommerceProfitSharing/Receivers/AddEcommerceProfitSharingReceiverRequest.cs @@ -39,7 +39,7 @@ /// [Newtonsoft.Json.JsonProperty("encrypted_name")] [System.Text.Json.Serialization.JsonPropertyName("encrypted_name")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string? EncryptedName { get; set; } /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/MarketingMemberCardOpen/Code/ImportMarketingMemberCardOpenCardPhoneRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/MarketingMemberCardOpen/Code/ImportMarketingMemberCardOpenCardPhoneRequest.cs index 8ce6bcd8..ebe095e8 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/MarketingMemberCardOpen/Code/ImportMarketingMemberCardOpenCardPhoneRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/MarketingMemberCardOpen/Code/ImportMarketingMemberCardOpenCardPhoneRequest.cs @@ -17,7 +17,7 @@ /// [Newtonsoft.Json.JsonProperty("encrypted_phone_number")] [System.Text.Json.Serialization.JsonPropertyName("encrypted_phone_number")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string EncryptedPhoneNumber { get; set; } = string.Empty; /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/MerchantService/ComplaintsV2/GetMerchantServiceComplaintByComplaintIdResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/MerchantService/ComplaintsV2/GetMerchantServiceComplaintByComplaintIdResponse.cs index ced0082c..03064e47 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/MerchantService/ComplaintsV2/GetMerchantServiceComplaintByComplaintIdResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/MerchantService/ComplaintsV2/GetMerchantServiceComplaintByComplaintIdResponse.cs @@ -94,7 +94,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("payer_phone")] [System.Text.Json.Serialization.JsonPropertyName("payer_phone")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string? PayerPhone { get; set; } /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/MerchantService/ComplaintsV2/QueryMerchantServiceComplaintsResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/MerchantService/ComplaintsV2/QueryMerchantServiceComplaintsResponse.cs index 09e751d5..f910a3c5 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/MerchantService/ComplaintsV2/QueryMerchantServiceComplaintsResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/MerchantService/ComplaintsV2/QueryMerchantServiceComplaintsResponse.cs @@ -58,7 +58,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("payer_phone")] [System.Text.Json.Serialization.JsonPropertyName("payer_phone")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string? PayerPhone { get; set; } /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/PartnerTransfer/Batches/GetPartnerTransferBatchDetailByOutDetailNumberResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/PartnerTransfer/Batches/GetPartnerTransferBatchDetailByOutDetailNumberResponse.cs index 0558bc26..18b94927 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/PartnerTransfer/Batches/GetPartnerTransferBatchDetailByOutDetailNumberResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/PartnerTransfer/Batches/GetPartnerTransferBatchDetailByOutDetailNumberResponse.cs @@ -18,7 +18,7 @@ /// [Newtonsoft.Json.JsonProperty("username")] [System.Text.Json.Serialization.JsonPropertyName("username")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public override string UserName { get; set; } = default!; } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/PayScoreBill/GetPayScoreMerchantBillResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/PayScoreBill/GetPayScoreMerchantBillResponse.cs index a8010539..d7a89516 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/PayScoreBill/GetPayScoreMerchantBillResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/PayScoreBill/GetPayScoreMerchantBillResponse.cs @@ -43,7 +43,7 @@ /// [Newtonsoft.Json.JsonProperty("encrypt_key")] [System.Text.Json.Serialization.JsonPropertyName("encrypt_key")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string EncryptKey { get; set; } = default!; /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/ProfitSharing/CreateProfitSharingOrderRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/ProfitSharing/CreateProfitSharingOrderRequest.cs index 32a97ca8..87e62bd4 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/ProfitSharing/CreateProfitSharingOrderRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/ProfitSharing/CreateProfitSharingOrderRequest.cs @@ -31,7 +31,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("name")] [System.Text.Json.Serialization.JsonPropertyName("name")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string? Name { get; set; } /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/ProfitSharing/Receivers/AddProfitSharingReceiverRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/ProfitSharing/Receivers/AddProfitSharingReceiverRequest.cs index 1157adcb..5464a47c 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/ProfitSharing/Receivers/AddProfitSharingReceiverRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/ProfitSharing/Receivers/AddProfitSharingReceiverRequest.cs @@ -46,7 +46,7 @@ /// [Newtonsoft.Json.JsonProperty("name")] [System.Text.Json.Serialization.JsonPropertyName("name")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string? Name { get; set; } /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/ProfitSharing/Receivers/AddProfitSharingReceiverResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/ProfitSharing/Receivers/AddProfitSharingReceiverResponse.cs index bb0a4223..8c5f1437 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/ProfitSharing/Receivers/AddProfitSharingReceiverResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/ProfitSharing/Receivers/AddProfitSharingReceiverResponse.cs @@ -32,7 +32,7 @@ /// [Newtonsoft.Json.JsonProperty("name")] [System.Text.Json.Serialization.JsonPropertyName("name")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string? Name { get; set; } /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/SmartGuide/CreateSmartGuideRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/SmartGuide/CreateSmartGuideRequest.cs index 50d26a7f..a1934bd0 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/SmartGuide/CreateSmartGuideRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/SmartGuide/CreateSmartGuideRequest.cs @@ -39,7 +39,7 @@ /// [Newtonsoft.Json.JsonProperty("name")] [System.Text.Json.Serialization.JsonPropertyName("name")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string UserName { get; set; } = string.Empty; /// @@ -47,7 +47,7 @@ /// [Newtonsoft.Json.JsonProperty("mobile")] [System.Text.Json.Serialization.JsonPropertyName("mobile")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string UserMobile { get; set; } = string.Empty; /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/SmartGuide/QuerySmartGuidesRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/SmartGuide/QuerySmartGuidesRequest.cs index 99a6000a..bbe2fc40 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/SmartGuide/QuerySmartGuidesRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/SmartGuide/QuerySmartGuidesRequest.cs @@ -32,7 +32,7 @@ /// [Newtonsoft.Json.JsonIgnore] [System.Text.Json.Serialization.JsonIgnore] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string? UserMobile { get; set; } /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/SmartGuide/QuerySmartGuidesResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/SmartGuide/QuerySmartGuidesResponse.cs index 98ed6a43..e18e7fac 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/SmartGuide/QuerySmartGuidesResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/SmartGuide/QuerySmartGuidesResponse.cs @@ -36,7 +36,7 @@ /// [Newtonsoft.Json.JsonProperty("name")] [System.Text.Json.Serialization.JsonPropertyName("name")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string UserName { get; set; } = default!; /// @@ -44,7 +44,7 @@ /// [Newtonsoft.Json.JsonProperty("mobile")] [System.Text.Json.Serialization.JsonPropertyName("mobile")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string UserMobile { get; set; } = default!; /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/SmartGuide/UpdateSmartGuideRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/SmartGuide/UpdateSmartGuideRequest.cs index c62281dc..09b0f8a5 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/SmartGuide/UpdateSmartGuideRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/SmartGuide/UpdateSmartGuideRequest.cs @@ -25,7 +25,7 @@ /// [Newtonsoft.Json.JsonProperty("name")] [System.Text.Json.Serialization.JsonPropertyName("name")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string? UserName { get; set; } /// @@ -33,7 +33,7 @@ /// [Newtonsoft.Json.JsonProperty("mobile")] [System.Text.Json.Serialization.JsonPropertyName("mobile")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string? UserMobile { get; set; } /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Transfer/Batches/CreateTransferBatchRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Transfer/Batches/CreateTransferBatchRequest.cs index fa5bbee2..0319bef6 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Transfer/Batches/CreateTransferBatchRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Transfer/Batches/CreateTransferBatchRequest.cs @@ -45,7 +45,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("user_name")] [System.Text.Json.Serialization.JsonPropertyName("user_name")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public string? UserName { get; set; } } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Transfer/Batches/GetTransferBatchDetailByOutDetailNumberResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Transfer/Batches/GetTransferBatchDetailByOutDetailNumberResponse.cs index fda6a5b5..8785c02a 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Transfer/Batches/GetTransferBatchDetailByOutDetailNumberResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Transfer/Batches/GetTransferBatchDetailByOutDetailNumberResponse.cs @@ -83,7 +83,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models /// [Newtonsoft.Json.JsonProperty("user_name")] [System.Text.Json.Serialization.JsonPropertyName("user_name")] - [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_PKCS8_ECB)] + [WechatTenpaySensitiveProperty(algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] public virtual string UserName { get; set; } = default!; /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Utilities/RSAUtility.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Utilities/RSAUtility.cs index 0bd844b8..1a5510fc 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Utilities/RSAUtility.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Utilities/RSAUtility.cs @@ -16,9 +16,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Utilities public static class RSAUtility { // REF: https://github.com/bcgit/bc-csharp/blob/master/crypto/src/security/CipherUtilities.cs - private const string RSA_CIPHER_ALG = "RSA/ECB/OAEPWITHSHA1ANDMGF1PADDING"; + private const string RSA_CIPHER_ALGORITHM_ECB = "RSA/ECB"; + private const string RSA_CIPHER_PADDING_OAEP_WITH_SHA1_AND_MGF1 = "OAEPWITHSHA1ANDMGF1PADDING"; // REF: https://github.com/bcgit/bc-csharp/blob/master/crypto/src/security/SignerUtilities.cs - private const string RSA_SIGNER_ALG = "SHA-256withRSA"; + private const string RSA_SIGNER_ALGORITHM_SHA256 = "SHA-256withRSA"; /// /// 使用私钥基于 SHA-256 算法生成签名。 @@ -112,14 +113,15 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Utilities /// /// PKCS#8 私钥字节数据。 /// 待解密的数据字节数据。 + /// 填充算法。(默认值:) /// 解密后的数据字节数组。 - public static byte[] DecryptWithECB(byte[] privateKeyBytes, byte[] cipherBytes) + public static byte[] DecryptWithECB(byte[] privateKeyBytes, byte[] cipherBytes, string paddingAlgorithm = RSA_CIPHER_PADDING_OAEP_WITH_SHA1_AND_MGF1) { if (privateKeyBytes == null) throw new ArgumentNullException(nameof(privateKeyBytes)); if (cipherBytes == null) throw new ArgumentNullException(nameof(cipherBytes)); RsaKeyParameters rsaKeyParams = (RsaKeyParameters)PrivateKeyFactory.CreateKey(privateKeyBytes); - return DecryptWithECB(rsaKeyParams, cipherBytes); + return DecryptWithECB(rsaKeyParams, cipherBytes, paddingAlgorithm); } /// @@ -127,15 +129,16 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Utilities /// /// PKCS#8 私钥(PEM 格式)。 /// 经 Base64 编码的待解密数据。 + /// 填充算法。(默认值:) /// 解密后的文本数据。 - public static string DecryptWithECB(string privateKey, string cipherText) + public static string DecryptWithECB(string privateKey, string cipherText, string paddingAlgorithm = RSA_CIPHER_PADDING_OAEP_WITH_SHA1_AND_MGF1) { if (privateKey == null) throw new ArgumentNullException(nameof(privateKey)); if (cipherText == null) throw new ArgumentNullException(nameof(cipherText)); byte[] privateKeyBytes = ConvertPkcs8PrivateKeyToByteArray(privateKey); byte[] cipherBytes = Convert.FromBase64String(cipherText); - byte[] plainBytes = DecryptWithECB(privateKeyBytes, cipherBytes); + byte[] plainBytes = DecryptWithECB(privateKeyBytes, cipherBytes, paddingAlgorithm); return Encoding.UTF8.GetString(plainBytes); } @@ -144,14 +147,15 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Utilities /// /// PKCS#8 公钥字节数据。 /// 待加密的数据字节数据。 + /// 填充算法。(默认值:) /// 加密后的数据字节数组。 - public static byte[] EncryptWithECB(byte[] publicKeyBytes, byte[] plainBytes) + public static byte[] EncryptWithECB(byte[] publicKeyBytes, byte[] plainBytes, string paddingAlgorithm = RSA_CIPHER_PADDING_OAEP_WITH_SHA1_AND_MGF1) { if (publicKeyBytes == null) throw new ArgumentNullException(nameof(publicKeyBytes)); if (plainBytes == null) throw new ArgumentNullException(nameof(plainBytes)); RsaKeyParameters rsaKeyParams = (RsaKeyParameters)PublicKeyFactory.CreateKey(publicKeyBytes); - return EncryptWithECB(rsaKeyParams, plainBytes); + return EncryptWithECB(rsaKeyParams, plainBytes, paddingAlgorithm); } /// @@ -159,15 +163,16 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Utilities /// /// PKCS#8 公钥(PEM 格式)。 /// 待加密的文本数据。 + /// 填充算法。(默认值:) /// 经 Base64 编码的加密数据。 - public static string EncryptWithECB(string publicKey, string plainText) + public static string EncryptWithECB(string publicKey, string plainText, string paddingAlgorithm = RSA_CIPHER_PADDING_OAEP_WITH_SHA1_AND_MGF1) { if (publicKey == null) throw new ArgumentNullException(nameof(publicKey)); if (plainText == null) throw new ArgumentNullException(nameof(plainText)); byte[] publicKeyBytes = ConvertPkcs8PublicKeyToByteArray(publicKey); byte[] plainBytes = Encoding.UTF8.GetBytes(plainText); - byte[] cipherBytes = EncryptWithECB(publicKeyBytes, plainBytes); + byte[] cipherBytes = EncryptWithECB(publicKeyBytes, plainBytes, paddingAlgorithm); return Convert.ToBase64String(cipherBytes); } @@ -176,15 +181,16 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Utilities /// /// 证书(PEM 格式)。 /// 待加密的文本数据。 + /// 填充算法。(默认值:) /// 经 Base64 编码的加密数据。 - public static string EncryptWithECBByCertificate(string certificate, string plainText) + public static string EncryptWithECBByCertificate(string certificate, string plainText, string paddingAlgorithm = RSA_CIPHER_PADDING_OAEP_WITH_SHA1_AND_MGF1) { if (certificate == null) throw new ArgumentNullException(nameof(certificate)); if (plainText == null) throw new ArgumentNullException(nameof(plainText)); RsaKeyParameters rsaKeyParams = ConvertCertificateToPublicKeyParams(certificate); byte[] plainBytes = Encoding.UTF8.GetBytes(plainText); - byte[] cipherBytes = EncryptWithECB(rsaKeyParams, plainBytes); + byte[] cipherBytes = EncryptWithECB(rsaKeyParams, plainBytes, paddingAlgorithm); return Convert.ToBase64String(cipherBytes); } @@ -285,7 +291,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Utilities private static byte[] SignWithSHA256(RsaKeyParameters rsaKeyParams, byte[] plainBytes) { - ISigner signer = SignerUtilities.GetSigner(RSA_SIGNER_ALG); + ISigner signer = SignerUtilities.GetSigner(RSA_SIGNER_ALGORITHM_SHA256); signer.Init(true, rsaKeyParams); signer.BlockUpdate(plainBytes, 0, plainBytes.Length); return signer.GenerateSignature(); @@ -293,22 +299,22 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Utilities private static bool VerifyWithSHA256(RsaKeyParameters rsaKeyParams, byte[] plainBytes, byte[] signBytes) { - ISigner signer = SignerUtilities.GetSigner(RSA_SIGNER_ALG); + ISigner signer = SignerUtilities.GetSigner(RSA_SIGNER_ALGORITHM_SHA256); signer.Init(false, rsaKeyParams); signer.BlockUpdate(plainBytes, 0, plainBytes.Length); return signer.VerifySignature(signBytes); } - private static byte[] EncryptWithECB(RsaKeyParameters rsaKeyParams, byte[] plainBytes) + private static byte[] EncryptWithECB(RsaKeyParameters rsaKeyParams, byte[] plainBytes, string paddingAlgorithm) { - IBufferedCipher cipher = CipherUtilities.GetCipher(RSA_CIPHER_ALG); + IBufferedCipher cipher = CipherUtilities.GetCipher($"{RSA_CIPHER_ALGORITHM_ECB}/{paddingAlgorithm}"); cipher.Init(true, rsaKeyParams); return cipher.DoFinal(plainBytes); } - private static byte[] DecryptWithECB(RsaKeyParameters rsaKeyParams, byte[] cipherBytes) + private static byte[] DecryptWithECB(RsaKeyParameters rsaKeyParams, byte[] cipherBytes, string paddingAlgorithm) { - IBufferedCipher cipher = CipherUtilities.GetCipher(RSA_CIPHER_ALG); + IBufferedCipher cipher = CipherUtilities.GetCipher($"{RSA_CIPHER_ALGORITHM_ECB}/{paddingAlgorithm}"); cipher.Init(false, rsaKeyParams); return cipher.DoFinal(cipherBytes); }