Fix various minor issues (#45)

* Update header version to 2.0.0

* Add space to cleartext message armouring

* Fix password encrypted binary files

* Clear key private params in helpers

* Do not unlock key if private key is nil

* Document changes

* Use defer for ClearPrivateKeyParams
This commit is contained in:
wussler 2020-04-27 21:01:23 +02:00 committed by GitHub
parent 0f35072bc4
commit 222decb919
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 28 additions and 7 deletions

View file

@ -19,13 +19,13 @@ func UpdatePrivateKeyPassphrase(
if err != nil {
return "", err
}
defer unlocked.ClearPrivateParams()
locked, err := unlocked.Lock(newPassphrase)
if err != nil {
return "", err
}
unlocked.ClearPrivateParams()
return locked.Armor()
}
@ -37,13 +37,13 @@ func GenerateKey(name, email string, passphrase []byte, keyType string, bits int
if err != nil {
return "", err
}
defer key.ClearPrivateParams()
locked, err := key.Lock(passphrase)
if err != nil {
return "", err
}
key.ClearPrivateParams()
return locked.Armor()
}