Skip to main content

Crate oxicrypto_cipher

Crate oxicrypto_cipher 

Source
Expand description

Raw single-block / stream cipher primitives for the OxiCrypto stack.

These are deliberately low-level building blocks, distinct from the authenticated oxicrypto-aead ciphers. They exist for QUIC header protection (RFC 9001 §5.4), which masks packet headers with a 5-byte sample of either an AES-ECB single-block encryption (§5.4.3) or a ChaCha20 keystream block (§5.4.4).

PrimitiveFunctionNotes
AES-128 single blockaes128_encrypt_blockone 16-byte ECB block
AES-256 single blockaes256_encrypt_blockone 16-byte ECB block
ChaCha20 keystream blockchacha20_keystream_blockRFC 8439 / RFC 9001 §5.4.4

All wrappers are #![forbid(unsafe_code)]; the underlying aes / chacha20 crates provide safe constructors (KeyInit::new, KeyIvInit::new) and operations (BlockEncrypt::encrypt_block, StreamCipher::apply_keystream).

Constants§

AES128_KEY_LEN
AES-128 key length in bytes.
AES256_KEY_LEN
AES-256 key length in bytes.
AES_BLOCK_LEN
AES block size in bytes.
CHACHA20_KEY_LEN
ChaCha20 key length in bytes.
CHACHA20_NONCE_LEN
ChaCha20 nonce length in bytes (IETF / RFC 8439 variant).

Functions§

aes128_encrypt_block
Encrypt a single 16-byte block with AES-128 in raw ECB mode.
aes256_encrypt_block
Encrypt a single 16-byte block with AES-256 in raw ECB mode.
chacha20_keystream_block
Produce ChaCha20 keystream bytes for a given 32-byte key, 32-bit block counter, and 12-byte nonce (RFC 8439 / RFC 9001 §5.4.4).