Switch to ProtonMail's openpgp implementation

golang/x/crypto/openpgp is frozen. This commit switches to ProtonMail's fork
github.com/ProtonMail/go-crypto/openpgp to have a version that is used and
maintained by the upstream project.
This commit is contained in:
Jan Dittberner 2021-06-26 15:30:31 +02:00
parent 2e467b3d2e
commit 13300f06a0
3 changed files with 18 additions and 13 deletions

View file

@ -8,10 +8,10 @@ import (
"os"
"time"
"github.com/ProtonMail/go-crypto/openpgp"
"github.com/ProtonMail/go-crypto/openpgp/armor"
"github.com/ProtonMail/go-crypto/openpgp/packet"
log "github.com/sirupsen/logrus"
"golang.org/x/crypto/openpgp"
"golang.org/x/crypto/openpgp/armor"
"golang.org/x/crypto/openpgp/packet"
)
const hoursInADay = 24
@ -46,7 +46,7 @@ func (r *OpenPGPRoot) SignPublicKey(pubKey []byte, algorithm crypto.Hash, days u
for _, i := range pe.Identities {
expiry := calculateExpiry(i, days)
if !i.SelfSignature.KeyExpired(time.Now()) {
if !i.SelfSignature.SigExpired(time.Now()) {
sig := &packet.Signature{
SigType: packet.SigTypeGenericCert,
PubKeyAlgo: signingKey.PrivateKey.PubKeyAlgo,
@ -113,7 +113,7 @@ func (r *OpenPGPRoot) findSigningKey(identifier string) (*openpgp.Entity, error)
log.Tracef("found %s", e.PrimaryKey.KeyIdString())
for _, i := range e.Identities {
if i.UserId.Email == identifier && len(e.Revocations) == 0 && !i.SelfSignature.KeyExpired(time.Now()) {
if i.UserId.Email == identifier && len(e.Revocations) == 0 && !i.SelfSignature.SigExpired(time.Now()) {
return e, nil
}
}