diff --git a/openpgp/v2/forwarding.go b/openpgp/v2/forwarding.go index 6d6498c6..1306c510 100644 --- a/openpgp/v2/forwarding.go +++ b/openpgp/v2/forwarding.go @@ -26,14 +26,13 @@ func (e *Entity) NewForwardingEntity( now := config.Now() - if _, err = e.VerifyPrimaryKey(now); err != nil { + if _, err = e.VerifyPrimaryKey(now, config); err != nil { return nil, nil, err } // Generate a new Primary key for the forwardee config.Algorithm = packet.PubKeyAlgoEdDSA config.Curve = packet.Curve25519 - keyLifetimeSecs := config.KeyLifetime() forwardeePrimaryPrivRaw, err := newSigner(config) if err != nil { @@ -49,7 +48,8 @@ func (e *Entity) NewForwardingEntity( Subkeys: []Subkey{}, } - err = forwardeeKey.addUserId(userIdData{name, comment, email}, config, now, keyLifetimeSecs, true) + keyProperties := selectKeyProperties(now, config, primary) + err = forwardeeKey.addUserId(userIdData{name, comment, email}, config, keyProperties) if err != nil { return nil, nil, err } @@ -64,7 +64,7 @@ func (e *Entity) NewForwardingEntity( continue } - forwarderSubKeySelfSig, err := forwarderSubKey.Verify(now) + forwarderSubKeySelfSig, err := forwarderSubKey.Verify(now, config) // Filter expiration & revokal if err != nil { continue diff --git a/openpgp/v2/keys.go b/openpgp/v2/keys.go index 40832ed6..192ebbaf 100644 --- a/openpgp/v2/keys.go +++ b/openpgp/v2/keys.go @@ -636,7 +636,7 @@ func (e *Entity) Serialize(w io.Writer) error { // public key packets contain no meaningful information and do not need // to be serialized. // Prevent public key export for forwarding keys, see forwarding section 4.1. - subKeySelfSig, err := subkey.LatestValidBindingSignature(time.Time{}) + subKeySelfSig, err := subkey.LatestValidBindingSignature(time.Time{}, nil) if subkey.PublicKey.PubKeyAlgo == packet.ExperimentalPubKeyAlgoHMAC || subkey.PublicKey.PubKeyAlgo == packet.ExperimentalPubKeyAlgoAEAD || (err == nil && subKeySelfSig.FlagForward) {