some linting
This commit is contained in:
parent
2ad9f081da
commit
162990f974
12 changed files with 44 additions and 28 deletions
|
@ -9,6 +9,10 @@ import (
|
|||
"io"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrCipherTextBlockSize = errors.New("ciphertext block size is too short")
|
||||
)
|
||||
|
||||
func EncryptAES(data string, key string) (string, error) {
|
||||
encrypted, err := EncryptBytesAES([]byte(data), key)
|
||||
if err != nil {
|
||||
|
@ -55,8 +59,7 @@ func DecryptBytesAES(cipherText []byte, key string) ([]byte, error) {
|
|||
}
|
||||
|
||||
if len(cipherText) < aes.BlockSize {
|
||||
err = errors.New("Ciphertext block size is too short!")
|
||||
return nil, err
|
||||
return nil, ErrCipherTextBlockSize
|
||||
}
|
||||
iv := cipherText[:aes.BlockSize]
|
||||
cipherText = cipherText[aes.BlockSize:]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue