Skip to main content

Module streaming_attachment_cipher

Module streaming_attachment_cipher 

Source
Expand description

AsyncRead / AsyncWrite wrapper around the streaming attachment ciphers.

ยงWire format

[discriminator (1 byte)] [format-specific header] [ciphertext...]
  • 0x02 is AES256-CBC-HMAC-Legacy-Stream

0x02 matches the long-standing EncString::Aes256Cbc_HmacSha256_B64 = 2 numbering.

Structsยง

StreamingAttachmentDecryptor
AsyncRead adapter that decrypts a streaming-attachment-encrypted wire stream from R and exposes the decrypted plaintext via [AsyncRead]. The cipher is selected by the 1-byte discriminator at the start of the wire and must agree with the supplied key.
StreamingAttachmentEncryptor
AsyncWrite adapter that takes plaintext and writes a streaming-attachment-encrypted wire stream to W. The cipher is selected by the SymmetricCryptoKey variant. The 1-byte discriminator is emitted before any plaintext is encrypted.
UnknownDiscriminator ๐Ÿ”’

Enumsยง

HeaderDiscriminator ๐Ÿ”’
StreamDecryptorState ๐Ÿ”’
StreamEncryptorState ๐Ÿ”’

Constantsยง

READ_SCRATCH_SIZE ๐Ÿ”’

Functionsยง

clone_io_error ๐Ÿ”’
io::Error is neither Clone nor Copy, so a stored error cannot be returned by value on a subsequent poll. Reconstruct an equivalent error (kind + message) to re-report it.