using System; namespace SKIT.FlurlHttpClient.Wechat.TenpayV3 { using SKIT.FlurlHttpClient.Primitives; public static class WechatTenpayClientEventVerificationExtensions { /// /// 验证回调通知事件签名。 /// /// REF:
///
/// ///
///
/// /// 微信回调通知中的 "Wechatpay-Timestamp" 请求标头。 /// 微信回调通知中的 "Wechatpay-Nonce" 请求标头。 /// 微信回调通知中请求正文。 /// 微信回调通知中的 "Wechatpay-Signature" 请求标头。 /// 微信回调通知中的 "Wechatpay-Serial" 请求标头。 /// public static ErroredResult VerifyEventSignature(this WechatTenpayClient client, string webhookTimestamp, string webhookNonce, string webhookBody, string webhookSignature, string webhookSerialNumber) { return VerifyEventSignature( client, webhookTimestamp: webhookTimestamp, webhookNonce: webhookNonce, webhookBody: webhookBody, webhookSignature: webhookSignature, webhookSignatureType: Constants.SignSchemes.WECHATPAY2_RSA_2048_WITH_SHA256, webhookSerialNumber: webhookSerialNumber ); } /// /// 验证回调通知事件签名。 /// /// REF:
///
/// ///
///
/// /// 微信回调通知中的 "Wechatpay-Timestamp" 请求标头。 /// 微信回调通知中的 "Wechatpay-Nonce" 请求标头。 /// 微信回调通知中请求正文。 /// 微信回调通知中的 "Wechatpay-Signature" 请求标头。 /// 微信回调通知中的 "Wechatpay-Signature-Type" 请求标头。 /// 微信回调通知中的 "Wechatpay-Serial" 请求标头。 /// public static ErroredResult VerifyEventSignature(this WechatTenpayClient client, string webhookTimestamp, string webhookNonce, string webhookBody, string webhookSignature, string webhookSignatureType, string webhookSerialNumber) { if (client is null) throw new ArgumentNullException(nameof(client)); return WechatTenpayClientSigningExtensions.VerifySignature( client, strTimestamp: webhookTimestamp, strNonce: webhookNonce, strContent: webhookBody, strSignature: webhookSignature, strSignScheme: webhookSignatureType, strSerialNumber: webhookSerialNumber ); } } }