0% found this document useful (0 votes)
87 views5 pages

Aes Test Cases

My aes project test cases

Uploaded by

pgame4058r
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
87 views5 pages

Aes Test Cases

My aes project test cases

Uploaded by

pgame4058r
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

AES-128 Test Cases and Results

Overview
This document presents comprehensive test cases for the AES-128 implementation using CBC mode
with PKCS#7 padding.

Test Case 1: NIST Standard Test Vector (ECB Mode)


Purpose: Verify core AES-128 encryption algorithm correctness

Input:

 Key: 2b7e151628aed2a6abf7158809cf4f3c
 Plaintext: 6bc1bee22e409f96e93d7e117393172a

Expected Output:

 Ciphertext: 3ad77bb40d7a3660a89ecaf32466ef97

Result: ✅ PASS - Output matches NIST SP 800-38A test vector

Test Case 2: CBC Mode Roundtrip Test


Purpose: Verify CBC encryption and decryption with padding

Input:

 Key: 2b7e151628aed2a6abf7158809cf4f3c
 IV: 00000000000000000000000000000000
 Message: "Hello AES CBC mode! This is a test message."

Process:
1. Apply PKCS#7 padding (43 bytes → 48 bytes)
2. Encrypt using CBC mode
3. Decrypt and remove padding
4. Verify original message is recovered

Result: ✅PASS - Original message successfully recovered

Test Case 3: Empty Message Test


Purpose: Test padding behavior with zero-length input

Input:
 Key: 2b7e151628aed2a6abf7158809cf4f3c
 IV: 00000000000000000000000000000000
 Message: "" (empty string)

Expected Behavior:
 PKCS#7 padding adds 16 bytes (all 0x10)
 Results in one encrypted block
 Decryption should return empty string

Result: ✅PASS - Empty message correctly handled

Test Case 4: Single Block Message (16 bytes)


Purpose: Test message that exactly fills one block

Input:
 Message: "1234567890123456" (exactly 16 bytes)

Expected Behavior:
 PKCS#7 padding adds another full block (16 bytes of 0x10)
 Results in two encrypted blocks
 Decryption should return original 16-byte message

Result: ✅PASS - Single block message correctly processed

Test Case 5: PKCS#7 Padding Validation


Purpose: Verify padding implementation correctness

Input:

 Data: [0x01, 0x02, 0x03, 0x04, 0x05] (5 bytes)

Expected Padding:
 Should add 11 bytes, each with value 0x0B
 Final padded data: [0x01, 0x02, 0x03, 0x04, 0x05, 0x0B, 0x0B, 0x0B, 0x0B,
0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B]

Result: ✅PASS - Padding correctly applied and removed

Test Case 6: File Encryption/Decryption


Purpose: Test practical file operations
Test Steps:
1. Create test file with known content
2. Encrypt file using CLI tool
3. Decrypt encrypted file
4. Compare original and decrypted files

Command Examples:
./aes genkey # Generate key and IV
echo "Test file content" > [Link] # Create test file
./aes encrypt [Link] [Link] [KEY] [IV]
./aes decrypt [Link] [Link] [KEY] [IV]
diff [Link] [Link] # Should show no differences

Result: ✅PASS - File operations work correctly

Test Case 7: Wrong Key Security Test


Purpose: Verify that wrong keys produce unrecoverable output

Process:
1. Encrypt message with correct key
2. Attempt decryption with different key
3. Verify that either:
o Decryption fails with padding error
o Decrypted output is garbage (not original message)

Result: ✅PASS - Wrong keys prevent successful decryption

Test Case 8: Large File Test


Purpose: Test performance and correctness with larger data

Test Data:
 File size: 1MB+ of random data
 Multiple blocks to test CBC chaining

Metrics Measured:
 Encryption/decryption speed
 Memory usage
 Correctness of roundtrip operation

Result: ✅PASS - Large files processed correctly


Test Case 9: Interactive Demo Validation
Purpose: Test user interface and demonstration features

Test Process:
1. Run interactive demo mode
2. Enter various test messages
3. Verify encryption/decryption display
4. Test wrong key demonstration

Result: ✅PASS - Demo provides clear educational value

Performance Metrics

Operation File Size Time Throughput


Encrypt 1KB <1ms >1 MB/s
Decrypt 1KB <1ms >1 MB/s
Encrypt 1MB ~10ms >100 MB/s
Decrypt 1MB ~10ms >100 MB/s

You might also like