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