tlslite.utils.chacha20_poly1305 module¶
Pure Python implementation of ChaCha20/Poly1305 AEAD cipher
Implementation that follows RFC 7539 and draft-ietf-tls-chacha20-poly1305-00
- class tlslite.utils.chacha20_poly1305.CHACHA20_POLY1305(key, implementation)¶
Bases:
object
Pure python implementation of ChaCha20/Poly1305 AEAD cipher
- __init__(key, implementation)¶
Set the initial state for the ChaCha20 AEAD
- open(nonce, ciphertext, data)¶
Decrypts and authenticates ciphertext using nonce and data. If the tag is valid, the plaintext is returned. If the tag is invalid, returns None.
- static pad16(data)¶
Return padding for the Associated Authenticated Data
- static poly1305_key_gen(key, nonce)¶
Generate the key for the Poly1305 authenticator
- seal(nonce, plaintext, data)¶
Encrypts and authenticates plaintext using nonce and data. Returns the ciphertext, consisting of the encrypted plaintext and tag concatenated.