tc_buffered_cipher
One buffered interface over block modes with or without padding, stream
ciphers, AEADs and asymmetric block ciphers, after Bouncy Castle's
IBufferedCipher. no_std, no
unsafe, Rust 1.85 or later.
Types
FixedBufferedBlockCipher,BufferedBlockCipher(alloc) — a block mode buffered to whole blocks.FixedPaddedBufferedBlockCipher,PaddedBufferedBlockCipher(alloc) — the same with padding, PKCS#7 by default.BufferedStreamCipher— a stream cipher.BufferedAeadBlockCipher,BufferedAeadCipher— an AEAD over a block cipher, or one that carries its own primitive.FixedBufferedAsymmetricBlockCipher,BufferedAsymmetricBlockCipher(alloc) — an asymmetric cipher or encoding, such as RSA with OAEP, fed in pieces.CipherDirection— encryption or decryption.BufferedError— the failures of the block, stream and asymmetric adapters.
Traits
BufferedCipher— sizing,process_bytes,do_finalandreset.BufferedCipherInit— starts a message from parameters of typeP.
Features
alloc(off by default) — the adapters sized at run time.
Usage
[]
= "0.2.0"
= "0.1.0"
= "0.1.0"
use AesEngine;
use ;
use ;
let mode = new;
let mut cipher = new;
cipher.init.expect;
let mut sealed = ;
let written = cipher.process_bytes.expect;
cipher.do_final.expect;
Security
Padded decryption is a padding oracle: the length it writes and a
CorruptPadding error reveal the padding. Authenticate CBC ciphertext before
decrypting it, or use an AEAD. Each adapter is constant time exactly when the
cipher it wraps is; the documentation states the timing of every item.
License
Licensed under either the MIT license or the Apache License, Version 2.0, at your option.