angelos.bin.nacl

Cython implementation of a libsodium wrapper.

class angelos.bin.nacl.BaseKey

Bases: object

Base class for encryption and signing keys.

property pk

Public key.

property seed

Signature seed.

property sk

Secret key.

property vk

Verification key.

class angelos.bin.nacl.ClientBox(client: angelos.bin.nacl.SecretKey, server: angelos.bin.nacl.PublicKey)

Bases: object

class angelos.bin.nacl.CryptoBox(sk: Union[angelos.bin.nacl.SecretKey, angelos.bin.nacl.DualSecret], pk: angelos.bin.nacl.PublicKey)

Bases: object

decrypt(crypto: bytes) → bytes
encrypt(message: bytes) → bytes
exception angelos.bin.nacl.CryptoFailure

Bases: RuntimeWarning

When crypto operation fail due to circumstantial reasons.

class angelos.bin.nacl.DualSecret(sk: bytes = None, seed: bytes = None)

Bases: angelos.bin.nacl.BaseKey

sign(message: bytes) → bytes
signature(message: bytes) → bytes
class angelos.bin.nacl.NaCl

Bases: object

classmethod random_aead_nonce() → bytes
static random_bytes(size) → bytes
classmethod random_nonce() → bytes
classmethod salsa_key() → bytes
exception angelos.bin.nacl.NaClError

Bases: RuntimeError

Error due to programmatic misuse.

DATA_LENGTH_ERROR = ('Data is to long', 103)
KEY_COMPUTATION_ERROR = ('Key computation failed', 101)
KEY_GENERATION_ERROR = ('Failed generate key(s)', 102)
KEY_LENGTH_ERROR = ('Invalid key due to length.', 100)
class angelos.bin.nacl.NetworkBox(us: angelos.bin.nacl.SecretKey, them: angelos.bin.nacl.PublicKey)

Bases: object

decrypt(crypto: bytes) → Tuple[bytes, bytes]
encrypt(message: bytes, data: bytes) → bytes
class angelos.bin.nacl.PublicKey(pk: bytes)

Bases: angelos.bin.nacl.BaseKey

class angelos.bin.nacl.SecretBox(key: bytes = None)

Bases: angelos.bin.nacl.BaseKey

decrypt(crypto: bytes) → bytes
encrypt(message: bytes) → bytes
class angelos.bin.nacl.SecretKey(sk: bytes = None)

Bases: angelos.bin.nacl.BaseKey

class angelos.bin.nacl.ServerBox(server: angelos.bin.nacl.SecretKey, client: angelos.bin.nacl.PublicKey)

Bases: angelos.bin.nacl.NetworkBox

class angelos.bin.nacl.Signer(seed: bytes = None)

Bases: angelos.bin.nacl.BaseKey

sign(message)
signature(message: bytes) → bytes
class angelos.bin.nacl.Verifier(vk: bytes)

Bases: angelos.bin.nacl.BaseKey

verify(signature: bytes) → bytes