run 'go get -u; make revendor'
Signed-off-by: Stephan Renatus <srenatus@chef.io>
This commit is contained in:
5
vendor/github.com/gtank/cryptopasta/encrypt.go
generated
vendored
5
vendor/github.com/gtank/cryptopasta/encrypt.go
generated
vendored
@@ -16,6 +16,7 @@ import (
|
||||
"crypto/aes"
|
||||
"crypto/cipher"
|
||||
"crypto/rand"
|
||||
"errors"
|
||||
"io"
|
||||
)
|
||||
|
||||
@@ -67,6 +68,10 @@ func Decrypt(ciphertext []byte, key *[32]byte) (plaintext []byte, err error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(ciphertext) < gcm.NonceSize() {
|
||||
return nil, errors.New("malformed ciphertext")
|
||||
}
|
||||
|
||||
return gcm.Open(nil,
|
||||
ciphertext[:gcm.NonceSize()],
|
||||
ciphertext[gcm.NonceSize():],
|
||||
|
Reference in New Issue
Block a user