filter(1)

NAME
filter - Joins keys into a keyring applying a filter

SYNOPSIS
filter [-o|--output] [--userid] [--name] [--email] [--domain] [--handle] [-P|--prune-certs] [-B|--binary] [--to-cert] [-h|--help] [FILE]

DESCRIPTION
Joins keys into a keyring applying a filter

This can be used to filter keys based on given predicates, e.g. whether they have a user id containing an email address with a certain domain. Additionally, the keys can be pruned to only include components matching the predicates.

If no filters are supplied, everything matches.

If multiple predicates are given, they are or'ed, i.e. a key matches if any of the predicates match. To require all predicates to match, chain multiple invocations of this command. See EXAMPLES for inspiration.

OPTIONS

-o, --output=FILE
    Writes to FILE or stdout if omitted

--userid=USERID
    Case-sensitively matches on the user id, requiring an exact match.

--name=NAME
    Parses user ids into name and email and case-sensitively matches on the name, requiring an exact match.

--email=ADDRESS
    Parses user ids into name and email address and case-sensitively matches on the email address, requiring an exact match.

--domain=FQDN
    Parses user ids into name and email address and case-sensitively matches on the domain of the email address, requiring an exact match.

--handle=FINGERPRINT|KEYID
    Matches on both primary keys and subkeys, including those certificates that match the given fingerprint or key id.

-P, --prune-certs=PRUNE_CERTS
    Removes certificate components not matching the filter

-B, --binary=BINARY
    Emits binary data

--to-cert=TO_CERTIFICATE
    Converts any keys in the input to certificates. Converting a key to a certificate removes secret key material from the key thereby turning it into a certificate.

-h, --help
    Print help information (use `-h` for a summary)

[FILE]
    Reads from FILE or stdin if omitted

EXTRA
EXAMPLES: # Converts a key to a cert (i.e., remove any secret key material) $ sq keyring filter --to-cert cat juliet.pgp # Gets the keys with a user id on example.org $ sq keyring filter --domain example.org keys.pgp # Gets the keys with a user id on example.org or example.net $ sq keyring filter --domain example.org --domain example.net keys.pgp # Gets the keys with a user id with the name Juliet $ sq keyring filter --name Juliet keys.pgp # Gets the keys with a user id with the name Juliet on example.org $ sq keyring filter --domain example.org keys.pgp | \
  sq keyring filter --name Juliet # Gets the keys with a user id on example.org, pruning other userids $ sq keyring filter --domain example.org --prune-certs certs.pgp