Utilities¶
-
class
nacl.utils.EncryptedMessage[source]¶ A
bytessubclass that holds a message that has been encrypted by aSecretBoxorBox. The full content of thebytesobject is the combinednonceandciphertext.-
nonce¶ The nonce used during the encryption of the
EncryptedMessage.
-
ciphertext¶ The ciphertext contained within the
EncryptedMessage.
-
-
nacl.utils.random(size=32)[source]¶ Returns a random bytestring with the given
size.Parameters: size (bytes) – The size of the random bytestring. Return bytes: The random bytestring.
-
nacl.utils.ensure(cond, *args, raising=nacl.exceptions.AssertionError)¶ Returns if a condition is true, otherwise raise a caller-configurable
ExceptionParameters: - cond (bool) – the condition to be checked
- args (sequence) – the arguments to be passed to the exception’s constructor
- raising (exception) – the exception to be raised if cond is False