Skip to content

Commit

Permalink
make key.IsUsable depend on KeyCaps gopasspw#1917
Browse files Browse the repository at this point in the history
  • Loading branch information
TM2500 committed Jul 1, 2021
1 parent a416ae2 commit ba57640
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/backend/crypto/gpg/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ type Capabilities struct {

// IsUseable returns true if GPG would assume this key is useable for encryption
func (k Key) IsUseable(alwaysTrust bool) bool {
if k.Caps.Deactivated {
return false
}
if !k.Caps.Encrypt {
return false
}
if !k.ExpirationDate.IsZero() && k.ExpirationDate.Before(time.Now()) {
return false
}
Expand Down

0 comments on commit ba57640

Please sign in to comment.