geofront.keystore
— Public key store¶
-
geofront.keystore.
KEY_TYPES
= {'ssh-dss': <class 'paramiko.dsskey.DSSKey'>, 'ssh-rsa': <class 'paramiko.rsakey.RSAKey'>}¶ (
collections.Mapping
) The mapping of supported key types.
-
exception
geofront.keystore.
AuthorizationError
¶ Authorization exception that rise when the given identity has no required permission to the key store.
-
exception
geofront.keystore.
DuplicatePublicKeyError
¶ Exception that rise when the given public key is already registered.
-
class
geofront.keystore.
KeyStore
¶ The key store backend interface. Every key store has to guarantee that public keys are unique for all identities i.e. the same public key can’t be registered across more than an identity.
-
deregister
(identity: geofront.identity.Identity, public_key: paramiko.pkey.PKey)¶ Remove the given
public_key
of theidentity
. It silently does nothing if there isn’t the givenpublic_key
in the store.Parameters: - ientity – the owner identity
- public_key (
paramiko.pkey.PKey
) – the public key to remove
Raises geofront.keystore.AuthorizationError: when the given
identity
has no required permission to the key store
-
list_keys
(identity: geofront.identity.Identity) → collections.abc.Set¶ List registered public keys of the given
identity
.Parameters: identity ( Identity
) – the owner of keys to listReturns: the set of paramiko.pkey.PKey
owned by theidentity
Return type: collections.abc.Set
Raises geofront.keystore.AuthorizationError: when the given identity
has no required permission to the key store
-
register
(identity: geofront.identity.Identity, public_key: paramiko.pkey.PKey)¶ Register the given
public_key
to theidentity
.Parameters: - ientity – the owner identity
- public_key (
paramiko.pkey.PKey
) – the public key to register
Raises: - geofront.keystore.AuthorizationError – when the given
identity
has no required permission to the key store - geofront.keystore.DuplicatePublicKeyError – when the
public_key
is already in use
-
-
exception
geofront.keystore.
KeyTypeError
¶ Unsupported public key type raise this type of error.
-
geofront.keystore.
format_openssh_pubkey
(key: paramiko.pkey.PKey) → str¶ Format the given
key
to an OpenSSH public key line, used byauthorized_keys
,id_rsa.pub
, etc.Parameters: key ( paramiko.pkey.PKey
) – the key object to formatReturns: a formatted openssh public key line Return type: str
-
geofront.keystore.
get_key_fingerprint
(key: paramiko.pkey.PKey, glue: str=':') → str¶ Get the hexadecimal fingerprint string of the
key
.Parameters: - key (
paramiko.pkey.PKey
) – the key to get fingerprint - glue (
str
) – glue character to be placed between bytes.':'
by default
Returns: the fingerprint string
Return type: - key (
-
geofront.keystore.
parse_openssh_pubkey
(line: str) → paramiko.pkey.PKey¶ Parse an OpenSSH public key line, used by
authorized_keys
,id_rsa.pub
, etc.Parameters: line (
str
) – a line of public keyReturns: the parsed public key
Return type: Raises: - ValueError – when the given
line
is an invalid format - KeyTypeError – when it’s an unsupported key type
- ValueError – when the given