Crate plain_aes

Source
Expand description

§plain-aes

This crate implements Rijndael’s cipher, in 128 bits and 192 bits modes respectively.

§Considerations

  • Within this crate, “block” or “block of data” refers specifically to a 16-byte sequence, as defined in the FIPS 197 specification.
  • For efficiency, most affine transformations and operations within GF(2^8) (e.g., polynomial multiplication) are implemented using pre-computed lookup tables.
  • While this crate is comprehensively tested, it should not be used in security-critical applications due to potential vulnerabilities. Modern CPUs offer hardware-accelerated AES, and some even have dedicated cryptographic coprocessors. These hardware features provide a more secure and performant solution for critical applications.

§Getting started

  1. Run cargo add plain-aes or add plain-aes to your Cargo.toml.
  2. Copy one of the examples included in encrypt/decrypt, or refer to the tests folder in the Github repo to get started.

Re-exports§

pub use internal::KeyExpansionError;

Modules§

internal
This module encapsulates all internal operations for this crate.

Enums§

CipherVersion
The cipher version to use, each cipher version encapsulates a key and ModeOfOperation.
ModeOfOperation
Mode of operation for AES.
OperationError
An error produced during an encryption/decryption.

Traits§

Encryptable
A trait implemented by types that can be used as input for encryption or decryption operations.

Functions§

decrypt
Decrypts a data object using the specified cipher version.
encrypt
Encrypts a data object using the specified cipher version.
pkcs5_padding
Applies PKCS#5 padding to blocks less than 16 bytes in length.