|
@@ -6,6 +6,7 @@ import (
|
|
|
"encoding/base64"
|
|
"encoding/base64"
|
|
|
"encoding/json"
|
|
"encoding/json"
|
|
|
"errors"
|
|
"errors"
|
|
|
|
|
+ "fmt"
|
|
|
|
|
|
|
|
"github.com/silenceper/wechat/v2/miniprogram/context"
|
|
"github.com/silenceper/wechat/v2/miniprogram/context"
|
|
|
)
|
|
)
|
|
@@ -90,6 +91,9 @@ func GetCipherText(sessionKey, encryptedData, iv string) ([]byte, error) {
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return nil, err
|
|
return nil, err
|
|
|
}
|
|
}
|
|
|
|
|
+ if len(ivBytes) != aes.BlockSize {
|
|
|
|
|
+ return nil, fmt.Errorf("bad iv length %d", len(ivBytes))
|
|
|
|
|
+ }
|
|
|
block, err := aes.NewCipher(aesKey)
|
|
block, err := aes.NewCipher(aesKey)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return nil, err
|
|
return nil, err
|