From 37fd86e0d0bcdf602654a8f7dc33aa5947cbe21e Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Fri, 30 Jul 2021 19:57:31 +0800 Subject: [PATCH] fix(work): fix typo --- .../Utilities/WxBizMsgCryptor.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Utilities/WxBizMsgCryptor.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Utilities/WxBizMsgCryptor.cs index a8292cdc..81f9d879 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/Utilities/WxBizMsgCryptor.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Utilities/WxBizMsgCryptor.cs @@ -75,11 +75,11 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.Utilities return res; } - private static byte[] AESDecrypt(byte[] keyBytes, byte[] ivBytes, byte[] chiperBytes) + private static byte[] AESDecrypt(byte[] keyBytes, byte[] ivBytes, byte[] cipherBytes) { if (keyBytes == null) throw new ArgumentNullException(nameof(keyBytes)); if (ivBytes == null) throw new ArgumentNullException(nameof(ivBytes)); - if (chiperBytes == null) throw new ArgumentNullException(nameof(chiperBytes)); + if (cipherBytes == null) throw new ArgumentNullException(nameof(cipherBytes)); using RijndaelManaged aes = new RijndaelManaged(); aes.KeySize = 256; @@ -94,9 +94,9 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.Utilities using (var ms = new MemoryStream()) using (var cs = new CryptoStream(ms, decryptor, CryptoStreamMode.Write)) { - byte[] bMsg = new byte[chiperBytes.Length + 32 - chiperBytes.Length % 32]; - Array.Copy(chiperBytes, bMsg, chiperBytes.Length); - cs.Write(chiperBytes, 0, chiperBytes.Length); + byte[] bMsg = new byte[cipherBytes.Length + 32 - cipherBytes.Length % 32]; + Array.Copy(cipherBytes, bMsg, cipherBytes.Length); + cs.Write(cipherBytes, 0, cipherBytes.Length); byte[] plainBytes = Decode2(ms.ToArray()); return plainBytes; @@ -136,20 +136,20 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.Utilities /// /// AES 解密企业微信加密数据。 /// - /// 企业微信推送来的加密文本内容(即 `Encrypt` 字段的值)。 + /// 企业微信推送来的加密文本内容(即 `Encrypt` 字段的值)。 /// 企业微信后台设置的 EncodingAESKey。 /// 企业微信 CorpId。 /// 解密后的文本内容。 - public static string AESDecrypt(string chiperText, string encodingAESKey, out string corpId) + public static string AESDecrypt(string cipherText, string encodingAESKey, out string corpId) { - if (chiperText == null) throw new ArgumentNullException(nameof(chiperText)); + if (cipherText == null) throw new ArgumentNullException(nameof(cipherText)); if (encodingAESKey == null) throw new ArgumentNullException(nameof(encodingAESKey)); - byte[] chiperBytes = Convert.FromBase64String(chiperText); + byte[] chiperBytes = Convert.FromBase64String(cipherText); byte[] keyBytes = Convert.FromBase64String(encodingAESKey + "="); byte[] ivBytes = new byte[16]; Array.Copy(keyBytes, ivBytes, 16); - byte[] btmpMsg = AESDecrypt(chiperBytes: chiperBytes, ivBytes: ivBytes, keyBytes: keyBytes); + byte[] btmpMsg = AESDecrypt(cipherBytes: chiperBytes, ivBytes: ivBytes, keyBytes: keyBytes); int len = BitConverter.ToInt32(btmpMsg, 16); len = IPAddress.NetworkToHostOrder(len);