class Crypto::AeadChacha20Poly1305
- Crypto::AeadChacha20Poly1305
- Reference
- Object
Overview
AEAD_CHACHA20_POLY1305 is an authenticated encryption with additional data algorithm.
Defined in:
crypto/aead.crConstructors
-
.new(key : Bytes, nonce : Bytes, io : IO)
The inputs to AEAD_CHACHA20_POLY1305 are: * key: A 256-bit key * nonce: A 96-bit nonce -- different for each invocation with the same key * io: the buffer to write the authenticated plain and ciphertext to
Instance Method Summary
-
#aad(data : Bytes)
Arbitrary length additional authenticated data (AAD).
-
#decrypt(data : Bytes, tag : Bytes) : Bytes
decrpyt parses the data and verifies the data with the tag returns the additional authenticated data.
-
#final : Bytes
write final footer
-
#update(data : Bytes)
An arbitrary length plaintext, has to be multiples of 16 bytes last call might be with less then 16 bytes
Constructor Detail
The inputs to AEAD_CHACHA20_POLY1305 are:
- key: A 256-bit key
- nonce: A 96-bit nonce -- different for each invocation with the same key
- io: the buffer to write the authenticated plain and ciphertext to
Instance Method Detail
Arbitrary length additional authenticated data (AAD). Needs to be written before the plaintext. Can be called multiple times, but only the last block can be less then 16 bytes.
decrpyt parses the data and verifies the data with the tag returns the additional authenticated data. The plaintext is written to the provided mem, in case the tag is not validating the data an exception is raised.
An arbitrary length plaintext, has to be multiples of 16 bytes last call might be with less then 16 bytes