Use new KeyExpired function

This commit is contained in:
Daniel Huigens 2019-04-27 07:22:10 +02:00
parent ea2fcb9438
commit 2091fc106c
3 changed files with 5 additions and 5 deletions

View file

@ -320,7 +320,7 @@ func (pm *PmCrypto) IsKeyExpiredBin(publicKey []byte) (bool, error) {
if subkey.Sig.FlagsValid &&
subkey.Sig.FlagEncryptCommunications &&
subkey.PublicKey.PubKeyAlgo.CanEncrypt() &&
!subkey.Sig.KeyExpired(now) &&
!subkey.PublicKey.KeyExpired(subkey.Sig, now) &&
(maxTime.IsZero() || subkey.Sig.CreationTime.After(maxTime)) {
candidateSubkey = i
maxTime = subkey.Sig.CreationTime
@ -349,7 +349,7 @@ func (pm *PmCrypto) IsKeyExpiredBin(publicKey []byte) (bool, error) {
i := firstIdentity
if !i.SelfSignature.FlagsValid || i.SelfSignature.FlagEncryptCommunications &&
e.PrimaryKey.PubKeyAlgo.CanEncrypt() &&
!i.SelfSignature.KeyExpired(now) {
!e.PrimaryKey.KeyExpired(i.SelfSignature, now) {
return false, nil
}
}

View file

@ -639,7 +639,7 @@ func FilterExpiredKeys(contactKeys []*KeyRing) (filteredKeys []*KeyRing, err err
hasExpired := false
hasUnexpired := false
for _, subkey := range entity.Subkeys {
if subkey.Sig.KeyExpired(now) {
if subkey.PublicKey.KeyExpired(subkey.Sig, now) {
hasExpired = true
} else {
hasUnexpired = true

View file

@ -140,8 +140,8 @@ func processSignatureExpiration(md *openpgp.MessageDetails, verifyTime int64) {
if verifyTime > 0 {
created := md.Signature.CreationTime.Unix()
expires := int64(math.MaxInt64)
if md.Signature.KeyLifetimeSecs != nil {
expires = int64(*md.Signature.KeyLifetimeSecs) + created
if md.Signature.SigLifetimeSecs != nil {
expires = int64(*md.Signature.SigLifetimeSecs) + created
}
if created-internal.CreationTimeOffset <= verifyTime && verifyTime <= expires {
md.SignatureError = nil