GODT-1432: Check if keys are active before unlocking

This commit is contained in:
James Houlahan
2021-11-23 16:35:37 +01:00
committed by Jakub
parent 59075f2e26
commit 6435f7b09a
11 changed files with 28 additions and 11 deletions

View File

@ -37,6 +37,7 @@ type PMKey struct {
PrivateKey *crypto.Key
Primary int
Token string
Active Boolean
Signature string
}
@ -135,6 +136,11 @@ func (keys *PMKeys) UnlockAll(passphrase []byte, userKey *crypto.KeyRing) (kr *c
}
for _, key := range *keys {
if !key.Active {
logrus.WithField("fingerprint", key.Fingerprint).Warn("Skipping inactive key")
continue
}
var secret []byte
if key.Token == "" || key.Signature == "" {