1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-04 12:52:27 +08:00

Update encryptor.go (#405)

This commit is contained in:
Lien Li
2021-06-07 10:23:49 +08:00
committed by GitHub
parent 828ba7875b
commit 13e5b3938b

View File

@@ -74,8 +74,8 @@ func pkcs7Unpad(data []byte, blockSize int) ([]byte, error) {
return data[:len(data)-n], nil
}
// getCipherText returns slice of the cipher text
func getCipherText(sessionKey, encryptedData, iv string) ([]byte, error) {
// GetCipherText returns slice of the cipher text
func GetCipherText(sessionKey, encryptedData, iv string) ([]byte, error) {
aesKey, err := base64.StdEncoding.DecodeString(sessionKey)
if err != nil {
return nil, err
@@ -103,7 +103,7 @@ func getCipherText(sessionKey, encryptedData, iv string) ([]byte, error) {
// Decrypt 解密数据
func (encryptor *Encryptor) Decrypt(sessionKey, encryptedData, iv string) (*PlainData, error) {
cipherText, err := getCipherText(sessionKey, encryptedData, iv)
cipherText, err := GetCipherText(sessionKey, encryptedData, iv)
if err != nil {
return nil, err
}