CLI command

skarbiec keys import

Bring the keys a vault names out of a GnuPG home into the vault's key file, once, by reading GnuPG's own files: the public keys from keyboxd's public-keys.d/pubring.db (or the older pubring.kbx), the secret halves from gpg-agent's private-keys-v1.d/<keygrip>.key. Nothing is run; no gpg, gpg-agent or keyboxd is needed.

Invocation#

Shell
skarbiec keys import [--gnupg-home <dir>] [--keys <fingerprint,...>]

Purpose#

Bring the keys a vault names out of a GnuPG home into the vault's key file, once, by reading GnuPG's own files: the public keys from keyboxd's public-keys.d/pubring.db (or the older pubring.kbx), the secret halves from gpg-agent's private-keys-v1.d/<keygrip>.key. Nothing is run; no gpg, gpg-agent or keyboxd is needed.

Required inputs and options#

  • --gnupg-home names the GnuPG home, else GNUPGHOME, else ~/.gnupg. --keys names the fingerprints to bring; without it, every recipient's and the recovery key the vault records. A protected GnuPG key opens with the configured unlock phrase (SKARBIEC_UNLOCK_FILE, SKARBIEC_UNLOCK). The key file is SKARBIEC_KEYS_FILE, else <vault without .json>.keys.json beside the vault.

Output and state effects#

  • Writes the key file owner-only, adding each key's public half and, where the home holds it, its secret half (sealed under the unlock phrase when one is configured); a key already there is kept, and a secret half it lacked, or the signing half of one imported for decryption only, is added. A key whose decryption (Curve25519) half opens but whose signing (Ed25519) half is protected by a passphrase this host is not given is imported for decryption only: it opens and reseals what is sealed to it here, and signing as it (an audit epoch checkpoint) is refused naming the key and SKARBIEC_UNLOCK_FILE. Prints ok, from, key_file and keys (fingerprint, user_ids, secret_half imported, decryption only or not on this host, signing_half naming why it was left when it was, changed), and journals keys-import.

Refusals#

  • A key the vault names that the home's public keyring lacks is refused naming it and the home, after the others are written; a key whose decryption half is protected and no unlock phrase is configured is refused naming SKARBIEC_UNLOCK_FILE, and one the phrase does not open is refused saying so; a key whose own signatures do not verify is refused. Another flag exits 2 naming it, and a fingerprint that is not 40 hexadecimal digits exits 2. A host with no vault at the path and no --keys is not refused: it answers ok with keys [] and a note that this host holds no vault, so it names no key to import (name keys with --keys to import them anyway). A GnuPG home with no public keyring (gone after the first import, or never there on a host keyed with owner key import) is not refused either when the key file already holds every key named and opens the vault's lowest live item: it answers ok with keys [] and a note that there is nothing to import, writing nothing; otherwise it is refused naming the home, both files looked for, what the key file lacks or the item that did not open, and --gnupg-home, owner key import or the key file's backup to bring the keys.