mirror of
https://github.com/silenceper/wechat.git
synced 2026-02-14 01:32:27 +08:00
Update encryptor.go (#405)
This commit is contained in:
@@ -74,8 +74,8 @@ func pkcs7Unpad(data []byte, blockSize int) ([]byte, error) {
|
|||||||
return data[:len(data)-n], nil
|
return data[:len(data)-n], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// getCipherText returns slice of the cipher text
|
// GetCipherText returns slice of the cipher text
|
||||||
func getCipherText(sessionKey, encryptedData, iv string) ([]byte, error) {
|
func GetCipherText(sessionKey, encryptedData, iv string) ([]byte, error) {
|
||||||
aesKey, err := base64.StdEncoding.DecodeString(sessionKey)
|
aesKey, err := base64.StdEncoding.DecodeString(sessionKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -103,7 +103,7 @@ func getCipherText(sessionKey, encryptedData, iv string) ([]byte, error) {
|
|||||||
|
|
||||||
// Decrypt 解密数据
|
// Decrypt 解密数据
|
||||||
func (encryptor *Encryptor) Decrypt(sessionKey, encryptedData, iv string) (*PlainData, error) {
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user