func (el EntityList) KeysByIdUsage(id uint64, requiredUsage byte) (keys []Key) {
	for _, key := range el.KeysById(id) {
		if len(key.Entity.Revocations) > 0 {
			continue
		}

		if key.SelfSignature.RevocationReason != nil {
			continue
		}

		if key.SelfSignature.FlagsValid && requiredUsage != 0 {
			var usage byte
			if key.SelfSignature.FlagCertify {
				usage |= packet.KeyFlagCertify
			}
			if key.SelfSignature.FlagSign {
				usage |= packet.KeyFlagSign
			}
			if key.SelfSignature.FlagEncryptCommunications {
				usage |= packet.KeyFlagEncryptCommunications
			}
			if key.SelfSignature.FlagEncryptStorage {
				usage |= packet.KeyFlagEncryptStorage
			}
			if usage&requiredUsage != requiredUsage {
				continue
			}
		}

		keys = append(keys, key)
	}
	return
}
// KeysByIdAndUsage returns the set of keys with the given id that also meet
// the key usage given by requiredUsage.  The requiredUsage is expressed as
// the bitwise-OR of packet.KeyFlag* values.
KeysByIdAndUsage returns the set of keys with the given id that also meet
the key usage given by requiredUsage.  The requiredUsage is expressed as
the bitwise-OR of packet.KeyFlag* values.
// KeysByIdAndUsage returns the set of keys with the given id that also meet // the key usage given by requiredUsage . The requiredUsage is expressed as // the bitwise - OR of packet . KeyFlag * values .
func (el EntityList) KeysByIdUsage(id uint64, requiredUsage byte) (keys []Key) {
	for _, key := range el.KeysById(id) {
		if len(key.Entity.Revocations) > 0 {
			continue
		}
		if key.SelfSignature.RevocationReason != nil {
			continue
		}
		if key.SelfSignature.FlagsValid && requiredUsage != 0 {
			var usage byte
			if key.SelfSignature.FlagCertify {
				usage |= packet.KeyFlagCertify
			}
			if key.SelfSignature.FlagSign {
				usage |= packet.KeyFlagSign
			}
			if key.SelfSignature.FlagEncryptCommunications {
				usage |= packet.KeyFlagEncryptCommunications
			}
			if key.SelfSignature.FlagEncryptStorage {
				usage |= packet.KeyFlagEncryptStorage
			}
			if usage&requiredUsage != requiredUsage {
				continue
			}
		}
		keys = append(keys, key)
	}
	return
}
func ( el EntityList ) KeysByIdUsage ( id uint64 , requiredUsage byte ) ( keys [ ] Key ) { for _ , key := range el . KeysById ( id ) { if len ( key . Entity . Revocations ) > 0 { continue } if key . SelfSignature . RevocationReason != nil { continue } if key . SelfSignature . FlagsValid && requiredUsage != 0 { var usage byte if key . SelfSignature . FlagCertify { usage |= packet . KeyFlagCertify } if key . SelfSignature . FlagSign { usage |= packet . KeyFlagSign } if key . SelfSignature . FlagEncryptCommunications { usage |= packet . KeyFlagEncryptCommunications } if key . SelfSignature . FlagEncryptStorage { usage |= packet . KeyFlagEncryptStorage } if usage & requiredUsage != requiredUsage { continue } } keys = append ( keys , key ) } return }
KeysByIdAndUsage returns the set of keys with the given id that also meet
the key usage given by requiredUsage.
KeysByIdAndUsage returns the set of keys with the given id that also meet the key usage given by requiredUsage .