1
0
Fork 0
mirror of https://github.com/Luzifer/go-openssl.git synced 2024-12-20 19:01:18 +00:00

Merge pull request #2 from ben-turner/patch-1

Check blocksize before retrieving Salt Header
This commit is contained in:
Knut Ahlers 2017-04-04 23:39:59 +02:00 committed by GitHub
commit 2ef3173d65

View file

@ -37,6 +37,9 @@ func (o *OpenSSL) DecryptString(passphrase, encryptedBase64String string) ([]byt
if err != nil {
return nil, err
}
if len(data) < aes.BlockSize {
return nil, fmt.Errorf("Data is too short")
}
saltHeader := data[:aes.BlockSize]
if string(saltHeader[:8]) != o.openSSLSaltHeader {
return nil, fmt.Errorf("Does not appear to have been encrypted with OpenSSL, salt header missing.")