Commit Graph

33 Commits

Author SHA1 Message Date
ae33c596ef
test(aes): add AES-CBC NIST SP 800-38A test vectors
Add integration tests for AES-CBC mode:
    - Single block encrypt/decrypt with NIST vectors
    - Multi-block encrypt with NIST vectors
    - Multi-block roundtrip verification
    - Empty plaintext handling
    - Arbitrary length plaintext
2025-12-31 04:12:20 +02:00
454d1d6011
feat(aes): add AES-CBC mode implementation
Add AesCbc struct with:
    - CBC mode encryption with PKCS#7 padding
    - CBC mode decryption with padding validation
    - XOR chaining with IV for first block
    - Expose encrypt_block/decrypt_block as pub(crate)
2025-12-31 00:58:49 +02:00
dd691cfa18
feat(cipher-core): add PKCS#7 padding support
Add pkcs7_pad and pkcs7_unpad functions for block cipher modes:
    - Pad data to block size multiples with N bytes of value N
    - Validate and remove padding on decryption
    - Add InvalidPadding variant to CipherError
2025-12-31 00:48:49 +02:00
f4480ba218
feat(aes): add IV (Initialization Vector) type for CBC mode
Add 128-bit IV type using secret_block! macro with:
    - Parsing from hex/binary/ASCII strings
    - Conversions to/from Block128 for XOR operations
    - Big-endian byte array conversions
2025-12-31 00:45:26 +02:00
220baa09ad
docs(cipher-factory): document public API types
Add doc comments to OutputFormat, OperationMode enums and their methods.
Add crate-level documentation describing the factory's purpose.
2025-12-31 00:26:31 +02:00
dd07a1d29b
docs(aes,des): add crate documentation and improve re-exports
Add crate-level doc comments with usage examples. Export additional
types for library users:
    - aes: Block32 (32-bit word type)
    - des: LR (Feistel round state)
2025-12-31 00:18:24 +02:00
9e013352a5
docs(aes): document cipher operation functions
Add doc comments explaining the four AES round operations:
    - SubBytes: S-box substitution for non-linearity
    - ShiftRows: cyclic row shifting for column diffusion
    - MixColumns: GF(2^8) matrix multiplication for row diffusion
    - AddRoundKey: XOR with derived subkey
2025-12-31 00:13:51 +02:00
aacb836e77
refactor(cipher-core): unify secret_block! and secret_key! macros
Move duplicated macro definitions from aes and des crates into
cipher-core for shared use. Both macros now:
    - Support u8 through u128 integer types
    - Include Zeroize derive for secure memory handling
    - Generate consistent formatting and conversion methods
2025-12-31 00:07:26 +02:00
451986d702
refactor(cipher-core): extract shared block parsing logic
Add generic BlockInt trait and parse_block_int<T>() function to
cipher-core, eliminating duplicate parsing code in aes and des crates.
    - BlockInt trait abstracts over u64/u128 integer types
    - Supports hex (0x), binary (0b), and ASCII string formats
    - Improved BlockError::InvalidByteStringLength with max/actual fields
2025-12-31 00:07:24 +02:00
656e112d9f
chore(aes): remove unused function 2025-12-30 23:48:38 +02:00
0687fe0431
fix: clippy warnings 2025-12-18 18:42:50 +02:00
9869036bdf
fix(aes): From matrix Key 2025-12-18 18:24:30 +02:00
f1a0ab75c3
fix: clippy warnings 2025-11-26 06:42:29 +02:00
46a47102b9
feat(factory): add cipher/algorithm helper functions 2025-11-24 12:02:22 +02:00
051bba33a8
feat(cli): add AES to cli app 2025-11-24 11:23:37 +02:00
5b3ca7eacf
test(aes): add 100 roundtrip integration tests 2025-11-24 11:01:02 +02:00
a8ccd3d294
refactor(aes): operate on custom values 2025-11-24 10:48:27 +02:00
37f8a97a11
refactor(aes): move to operations module 2025-11-24 08:50:22 +02:00
505cc8b08e
feat(aes): Add SubkeyChunks and SubkeyChunksRev iterators to Subkeys
- Implements `chunks()` returning iterator over 4-element subkey arrays.
- Implements `chunks_rev()` returning reverse iterator for decryption.
- Enables cipher rounds to iterate over round keys sequentially and in reverse.
2025-11-24 08:50:22 +02:00
dae5b69966
feat(aes): Add missing transformation methods to Block128 2025-11-24 08:50:22 +02:00
830c457b2a
feat(aes): Implement transform_impl with encryption and decryption rounds
- Implements core `transform_impl` handling both Encrypt and Decrypt actions.
- Implements 10-round AES encryption (standard rounds + final round).
- Implements 10-round AES decryption (inverse rounds + final inverse round).
- Adds `add_round_key` helper to XOR state with subkey block.
2025-11-24 08:50:22 +02:00
fc3eadcf3b
feat(aes): Implement InvShiftRows and InvMixColumns transformations
- Implements `inv_shift_rows` performing cyclic right shifts on state rows.
- Implements `inv_mix_columns` using inverse Galois Field matrix multiplication.
- Adds unit tests verifying inverse transformations are true inverses.
2025-11-24 08:50:22 +02:00
70a0e183b5
feat(aes): Implement ShiftRows and MixColumns transformations
- Implements `shift_rows` performing cyclic shifts on the state matrix rows.
- Implements `mix_columns` using Galois Field matrix multiplication.
- Adds `gmul` and `xtime` const helpers for GF(2^8) arithmetic.
- Adds unit tests verifying transformations against FIPS-197 vectors.
2025-11-24 08:50:22 +02:00
3de3440f16
feat(aes): add inverse SBox lookup 2025-11-24 08:50:22 +02:00
b2c5209214
feat(aes): add substitute bytes 2025-11-24 08:50:22 +02:00
7e5162fb44
feat(aes): add round key 2025-11-24 08:50:22 +02:00
4007a9a04d
fix: clippy warnings 2025-11-24 08:50:22 +02:00
bf6ae712a7
feat(aes): generate subkeys 2025-11-24 08:50:22 +02:00
88328256b3
feat(aes): add subkey blanket 2025-11-24 08:50:22 +02:00
8b80e17f82
feat(aes): add 128 bit key and block 2025-11-24 08:50:22 +02:00
bc1622e43f
chore: use workspace package vars 2025-11-24 08:50:22 +02:00
27b31d1fcc
refactor: update error methods 2025-10-13 15:02:34 +03:00
cb8128addf
Initial commit 2025-10-13 12:49:49 +03:00