func (e *Entity) signingKey(now time.Time) (Key, bool) {
	candidateSubkey := -1

	for i, subkey := range e.Subkeys {
		if subkey.Sig.FlagsValid &&
			subkey.Sig.FlagSign &&
			subkey.PublicKey.PubKeyAlgo.CanSign() &&
			!subkey.Sig.KeyExpired(now) {
			candidateSubkey = i
			break
		}
	}

	if candidateSubkey != -1 {
		subkey := e.Subkeys[candidateSubkey]
		return Key{e, subkey.PublicKey, subkey.PrivateKey, subkey.Sig}, true
	}

	// If we have no candidate subkey then we assume that it's ok to sign
	// with the primary key.
	i := e.primaryIdentity()
	if !i.SelfSignature.FlagsValid || i.SelfSignature.FlagSign &&
		!i.SelfSignature.KeyExpired(now) {
		return Key{e, e.PrimaryKey, e.PrivateKey, i.SelfSignature}, true
	}

	return Key{}, false
}
// signingKey return the best candidate Key for signing a message with this
// Entity.
signingKey return the best candidate Key for signing a message with this
Entity.
// signingKey return the best candidate Key for signing a message with this // Entity .
func (e *Entity) signingKey(now time.Time) (Key, bool) {
	candidateSubkey := -1
	for i, subkey := range e.Subkeys {
		if subkey.Sig.FlagsValid &&
			subkey.Sig.FlagSign &&
			subkey.PublicKey.PubKeyAlgo.CanSign() &&
			!subkey.Sig.KeyExpired(now) {
			candidateSubkey = i
			break
		}
	}
	if candidateSubkey != -1 {
		subkey := e.Subkeys[candidateSubkey]
		return Key{e, subkey.PublicKey, subkey.PrivateKey, subkey.Sig}, true
	}
	i := e.primaryIdentity()
	if !i.SelfSignature.FlagsValid || i.SelfSignature.FlagSign &&
		!i.SelfSignature.KeyExpired(now) {
		return Key{e, e.PrimaryKey, e.PrivateKey, i.SelfSignature}, true
	}
	return Key{}, false
}
func ( e * Entity ) signingKey ( now time . Time ) ( Key , bool ) { candidateSubkey := - 1 for i , subkey := range e . Subkeys { if subkey . Sig . FlagsValid && subkey . Sig . FlagSign && subkey . PublicKey . PubKeyAlgo . CanSign ( ) && ! subkey . Sig . KeyExpired ( now ) { candidateSubkey = i break } } if candidateSubkey != - 1 { subkey := e . Subkeys [ candidateSubkey ] return Key { e , subkey . PublicKey , subkey . PrivateKey , subkey . Sig } , true } i := e . primaryIdentity ( ) if ! i . SelfSignature . FlagsValid || i . SelfSignature . FlagSign && ! i . SelfSignature . KeyExpired ( now ) { return Key { e , e . PrimaryKey , e . PrivateKey , i . SelfSignature } , true } return Key { } , false }
signingKey return the best candidate Key for signing a message with this
Entity.
signingKey return the best candidate Key for signing a message with this Entity .
// If we have no candidate subkey then we assume that it's ok to sign // with the primary key.