Part of lp.services.crypto.interfaces View In Hierarchy
| 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}. |
This includes the public key to ease future key rotation.
| Parameters | data | An unencrypted byte string to encrypt. |
| Returns | A tuple of (base64-encoded public key, base64-encoded encrypted text string). | |
| Raises | RuntimeError | if no public key is configured for this container. |
| Parameters | data | A tuple of (base64-encoded public key, base64-encoded encrypted text string) to decrypt. |
| Returns | An unencrypted byte string. | |
| Raises | ValueError | if no private key is configured for this container that corresponds to the requested public key. |
| CryptoError | if decryption failed. | |