Merge pull request #332 from jcrd/kdf-header

Check for KDF header in is_valid_key
This commit is contained in:
Jaromil 2018-11-04 16:01:02 +01:00 committed by GitHub
commit a14a39ae12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

8
tomb
View File

@ -921,6 +921,14 @@ is_valid_key() {
_message "Key is an image, it might be valid."
return 0 }
[[ $KDF == 1 ]] && { ! option_is_set -g } && { option_is_set --kdf } && {
_head="${key[(f)1]}"
[[ $_head =~ '^_KDF_' ]] || {
_warning "Key is missing KDF header."
return 1
}
}
[[ $key =~ "BEGIN PGP" ]] && {
_message "Key is valid."
return 0 }