fairdm.backups.keys#
The public key a portal’s backups are encrypted to.
Module Contents#
Classes#
An armoured OpenPGP public key that backups are encrypted to. |
API#
- class BackupKey(armored: str)[source]#
An armoured OpenPGP public key that backups are encrypted to.
One class serves the production checks and
run_backup, so what the checks accept is exactly what a backup is encrypted with.Args: armored: The key as armoured text, such as the value of
BACKUP_PUBLIC_KEY.Initialization
- PRIVATE_ARMOUR#
‘PRIVATE KEY BLOCK’
- home() tempfile.TemporaryDirectory[str][source]#
Return a new, empty keyring directory that is removed when its block ends.
Returns: A context manager yielding the path of the directory, under django-dbbackup’s temporary directory.
- import_into(home: str) str | None[source]#
Import the key into the keyring at
home.Args: home: The keyring directory.
Returns: The fingerprint of a key that can encrypt, or
Nonewhen the text holds no such key, or holds secret key material.Raises: OSError: gpg is not installed.
- property fingerprint: str | None#
The fingerprint of a key that can encrypt, or
None.It is
Nonewhen the text is not an armoured public key, the key cannot encrypt, or the text holds a secret key, so the portal never holds the key that decrypts its backups.Raises: OSError: gpg is not installed.
- keyring() collections.abc.Iterator[None][source]#
Make django-dbbackup encrypt to this key for the length of the block.
The key is imported into a new keyring that is removed on exit. django-dbbackup overwrites its trust setting when it is imported, and gpg refuses a recipient whose trust is unknown, so trust is set here. The keyring, recipient and trust are restored on exit, also after an exception.
Yields: Nothing.
Raises: ValueError: The text is not a public key that can encrypt. OSError: gpg is not installed.