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:
commit
2ef3173d65
1 changed files with 3 additions and 0 deletions
|
@ -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.")
|
||||
|
|
Loading…
Reference in a new issue