|
@@ -63,12 +63,13 @@ func (a *AesCrypto) Decrypt(crypted []byte) ([]byte, error) {
|
|
if err != nil {
|
|
if err != nil {
|
|
return nil, err
|
|
return nil, err
|
|
}
|
|
}
|
|
|
|
+ n := len(crypted)
|
|
blockSize := block.BlockSize()
|
|
blockSize := block.BlockSize()
|
|
- if len(crypted)%blockSize != 0 {
|
|
|
|
|
|
+ if n%blockSize != 0 {
|
|
return nil, errors.New(`crypto/cipher: input not full blocks`)
|
|
return nil, errors.New(`crypto/cipher: input not full blocks`)
|
|
}
|
|
}
|
|
blockMode := cipher.NewCBCDecrypter(block, a.IV[:blockSize])
|
|
blockMode := cipher.NewCBCDecrypter(block, a.IV[:blockSize])
|
|
- origData := make([]byte, len(crypted))
|
|
|
|
|
|
+ origData := make([]byte, n)
|
|
blockMode.CryptBlocks(origData, crypted)
|
|
blockMode.CryptBlocks(origData, crypted)
|
|
origData = pkcs7UnPadding(origData)
|
|
origData = pkcs7UnPadding(origData)
|
|
|
|
|