l.s.c.i.IEncryptedContainer(Interface) : interface documentation

Part of lp.services.crypto.interfaces View In Hierarchy

Interface to a container that can encrypt and decrypt data.
Attribute can_encrypt True iff this container has the configuration it needs to encrypt data.
Method encrypt Encrypt a blob of data to a JSON-serialisable form.
Attribute can_decrypt True iff this container has the configuration it needs to decrypt data.
Method decrypt Decrypt data that was encrypted by L{encrypt}.
can_encrypt =
True iff this container has the configuration it needs to encrypt data.
def encrypt(data):
Encrypt a blob of data to a JSON-serialisable form.

This includes the public key to ease future key rotation.

ParametersdataAn unencrypted byte string to encrypt.
ReturnsA tuple of (base64-encoded public key, base64-encoded encrypted text string).
RaisesRuntimeErrorif no public key is configured for this container.
can_decrypt =
True iff this container has the configuration it needs to decrypt data.
def decrypt(data):
Decrypt data that was encrypted by L{encrypt}.
ParametersdataA tuple of (base64-encoded public key, base64-encoded encrypted text string) to decrypt.
ReturnsAn unencrypted byte string.
RaisesValueErrorif no private key is configured for this container that corresponds to the requested public key.
CryptoErrorif decryption failed.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.