class nucypher.keystore.keypairs.DecryptingKeypair(*args, **kwargs)[source]

A keypair for Umbral

decrypt(message_kit: nucypher.crypto.kits.MessageKit) → bytes[source]

Decrypt data encrypted with Umbral.

class nucypher.keystore.keypairs.HostingKeypair(host: str, checksum_public_address: str = None, private_key: Union[umbral.keys.UmbralPrivateKey, umbral.keys.UmbralPublicKey] = None, curve=None, certificate=None, certificate_filepath: str = None, generate_certificate=True)[source]

A keypair for TLS’ing.

class nucypher.keystore.keypairs.Keypair(private_key=None, public_key=None, generate_keys_if_needed=True)[source]

A parent Keypair class for all types of Keypairs.


Hashes the key using keccak-256 and returns the hexdigest in bytes.

Returns:Hexdigest fingerprint of key (keccak-256) in bytes
serialize_pubkey(as_b64=False) → bytes[source]

Serializes the pubkey for storage/transport in either urlsafe base64 or as a bytestring.

Parameters:as_b64 – Return the pubkey as urlsafe base64 byte string
Returns:The serialized pubkey in bytes
class nucypher.keystore.keypairs.SigningKeypair(*args, **kwargs)[source]

A SigningKeypair that uses ECDSA.

sign(message: bytes) → bytes[source]

Signs a hashed message and returns a signature.

Parameters:message – The message to sign
Returns:Signature in bytes
class nucypher.keystore.keystore.KeyStore(sqlalchemy_engine=None)[source]

A storage class of cryptographic keys.

add_key(key, is_signing=True, session=None) → nucypher.keystore.db.models.Key[source]
Parameters:key – Keypair object to store in the keystore.
Returns:The newly added key object.
add_policy_arrangement(expiration, id, kfrag=None, alice_pubkey_sig=None, alice_signature=None, session=None) → nucypher.keystore.db.models.PolicyArrangement[source]

Creates a PolicyArrangement to the Keystore.

Returns:The newly added PolicyArrangement object
add_workorder(bob_pubkey_sig, bob_signature, arrangement_id, session=None) → nucypher.keystore.db.models.Workorder[source]

Adds a Workorder to the keystore.

del_key(fingerprint: bytes, session=None)[source]

Deletes a key from the KeyStore.

Parameters:fingerprint – Fingerprint of key to delete
del_policy_arrangement(arrangement_id: bytes, session=None)[source]

Deletes a PolicyArrangement from the Keystore.

del_workorders(arrangement_id: bytes, session=None)[source]

Deletes a Workorder from the Keystore.

get_key(fingerprint: bytes, session=None) → Union[nucypher.keystore.keypairs.DecryptingKeypair, nucypher.keystore.keypairs.SigningKeypair][source]

Returns a key from the KeyStore.

Parameters:fingerprint – Fingerprint, in bytes, of key to return
Returns:Keypair of the returned key.
get_policy_arrangement(arrangement_id: bytes, session=None) → nucypher.keystore.db.models.PolicyArrangement[source]

Returns the PolicyArrangement by its HRAC.

Returns:The PolicyArrangement object
get_workorders(arrangement_id: bytes, session=None) → nucypher.keystore.db.models.Workorder[source]

Returns a list of Workorders by HRAC.

exception nucypher.keystore.keystore.NotFound[source]

Exception class for KeyStore calls for objects that don’t exist.