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#
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.
- skarbiec.keys.import keys-import-no-keyring — exit 1: importing the vault's keys from {home}; fix: name the GnuPG home that holds the vault's keys with --gnupg-home <dir>, or bring them with skarbiec owner key import <file> or the key file from its backup
- skarbiec.keys.import keys-import-no-keyring-item-unopened — exit 1: importing the vault's keys from {home}; fix: name the GnuPG home that holds the vault's secret keys with --gnupg-home <dir>, or bring them with skarbiec owner key import <file> or the key file from its backup; skarbiec doctor names why {item} does not open
- skarbiec.keys.import keys-import-keyring-damaged — exit 1: reading the public keys in {file}; fix: gpg --homedir {home} --list-keys says whether gpg itself reads it; if gpg is writing it now, run the import again
- skarbiec.keys.import keys-import-key-unreadable — exit 1: importing the key {fingerprint} from {home}; fix: give its holder a new Ed25519 key with a Curve25519 encryption subkey: skarbiec recipient rekey <uid> --import <public-key-file> --yes
- skarbiec.keys.import keys-import-key-no-subkey — exit 1: importing the key {fingerprint} from {home}; fix: give its holder a new Ed25519 key with a Curve25519 encryption subkey: skarbiec recipient rekey <uid> --import <public-key-file> --yes
- skarbiec.keys.import keys-import-secret-no-phrase — exit 1: reading the secret half of {fingerprint} in {home}; fix: a key protected by a passphrase opens with the one written to the owner-only file SKARBIEC_UNLOCK_FILE names (default ~/.stado/skarbiec-unlock); otherwise gpg --homedir {home} --list-secret-keys {fingerprint} says whether gpg itself opens it
- skarbiec.keys.import keys-import-secret-wrong-passphrase — exit 1: reading the secret half of {fingerprint} in {home}; fix: a key protected by a passphrase opens with the one written to the owner-only file SKARBIEC_UNLOCK_FILE names (default ~/.stado/skarbiec-unlock); otherwise gpg --homedir {home} --list-secret-keys {fingerprint} says whether gpg itself opens it
- skarbiec.keys.import keys-import-secret-unsupported — exit 1: reading the secret half of {fingerprint} in {home}; fix: a key protected by a passphrase opens with the one written to the owner-only file SKARBIEC_UNLOCK_FILE names (default ~/.stado/skarbiec-unlock); otherwise gpg --homedir {home} --list-secret-keys {fingerprint} says whether gpg itself opens it
- skarbiec.keys.import keys-import-secret-damaged — exit 1: reading the secret half of {fingerprint} in {home}; fix: a key protected by a passphrase opens with the one written to the owner-only file SKARBIEC_UNLOCK_FILE names (default ~/.stado/skarbiec-unlock); otherwise gpg --homedir {home} --list-secret-keys {fingerprint} says whether gpg itself opens it
- skarbiec.keys.import keys-import-agent-file-not-text — exit 1: reading the gpg-agent key file {file}; fix: nothing to do when it is no vault key's; gpg --homedir {home} --list-secret-keys names what it holds
- skarbiec.keys.import keys-import-missing — exit 1: importing the vault's keys from {home}; fix: import those keys' public halves into that GnuPG home, or name the home that holds them with --gnupg-home, then run keys import again