Skip to content

Commit d2c5f5e

Browse files
committed
pgp: add ExpiredKeys
1 parent c29fff7 commit d2c5f5e

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

pgp/internal.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,12 @@ func (g *GoVerifier) VerifyDetachedSignature(signature, cleartext io.Reader, sho
412412
return errors.Wrap(err, "failed to verify detached signature")
413413
}
414414

415+
for _, signer := range signers {
416+
if signer.Entity != nil && signer.IsExpired {
417+
return errors.Errorf("signature key %s has expired", KeyFromUint64(signer.IssuerKeyID))
418+
}
419+
}
420+
415421
return nil
416422
}
417423

@@ -455,7 +461,9 @@ func (g *GoVerifier) VerifyClearsigned(clearsigned io.Reader, showKeyTip bool) (
455461

456462
for _, signer := range signers {
457463
if signer.Entity != nil {
458-
if !signer.IsExpired {
464+
if signer.IsExpired {
465+
result.ExpiredKeys = append(result.ExpiredKeys, KeyFromUint64(signer.IssuerKeyID))
466+
} else {
459467
result.GoodKeys = append(result.GoodKeys, KeyFromUint64(signer.IssuerKeyID))
460468
}
461469
} else {

pgp/pgp.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ func KeyFromUint64(key uint64) Key {
3636
type KeyInfo struct {
3737
GoodKeys []Key
3838
MissingKeys []Key
39+
ExpiredKeys []Key
3940
}
4041

4142
// Signer interface describes facility implementing signing of files

0 commit comments

Comments
 (0)