diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-24 05:59:11 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-24 05:59:11 +0300 |
commit | 225ef13cc7f58b69ef4c4db6308a225c726359f7 (patch) | |
tree | 75454aa3d5b4042ddacbf22ddab2680c47caf405 /utils/block/cxx | |
parent | test: locate executables in PATH (diff) | |
download | aes-tools-225ef13cc7f58b69ef4c4db6308a225c726359f7.tar.gz aes-tools-225ef13cc7f58b69ef4c4db6308a225c726359f7.zip |
move executables from test/ to utils/
Diffstat (limited to '')
-rw-r--r-- | utils/block/cxx/CMakeLists.txt | 11 | ||||
-rw-r--r-- | utils/block/cxx/README.md | 60 | ||||
-rw-r--r-- | utils/block/cxx/aes_common.hpp (renamed from test/aes_common.hpp) | 0 | ||||
-rw-r--r-- | utils/block/cxx/aes_decrypt_block.cpp (renamed from test/aes_decrypt_block.cpp) | 0 | ||||
-rw-r--r-- | utils/block/cxx/aes_encrypt_block.cpp (renamed from test/aes_encrypt_block.cpp) | 0 |
5 files changed, 71 insertions, 0 deletions
diff --git a/utils/block/cxx/CMakeLists.txt b/utils/block/cxx/CMakeLists.txt new file mode 100644 index 0000000..8df91d0 --- /dev/null +++ b/utils/block/cxx/CMakeLists.txt @@ -0,0 +1,11 @@ +find_package(Boost REQUIRED COMPONENTS program_options) + +add_executable(util_aes_encrypt_block aes_encrypt_block.cpp aes_common.hpp) +target_include_directories(util_aes_encrypt_block PRIVATE ${Boost_INCLUDE_DIRS}) +target_link_libraries(util_aes_encrypt_block libaesni libaesnixx ${Boost_LIBRARIES}) +set_target_properties(util_aes_encrypt_block PROPERTIES OUTPUT_NAME aes_encrypt_block) + +add_executable(util_aes_decrypt_block aes_decrypt_block.cpp aes_common.hpp) +target_include_directories(util_aes_decrypt_block PRIVATE ${Boost_INCLUDE_DIRS}) +target_link_libraries(util_aes_decrypt_block libaesni libaesnixx ${Boost_LIBRARIES}) +set_target_properties(util_aes_decrypt_block PROPERTIES OUTPUT_NAME aes_decrypt_block) diff --git a/utils/block/cxx/README.md b/utils/block/cxx/README.md new file mode 100644 index 0000000..bce2434 --- /dev/null +++ b/utils/block/cxx/README.md @@ -0,0 +1,60 @@ +# Block encryption utilities + +Here are a couple of useful block encryption utilities built on top of the library. +Each of the utilities accepts `--help` flag, which can be used to examine utility's usage info. + +On older CPUs, you can run the utilities [using Intel SDE](https://github.com/egor-tensin/aesni#running-on-older-cpus). + +## aes_encrypt_block.exe + +Encrypts 16-byte blocks using AES-128/192/256 in the specified mode of operation. + +### Usage examples + +For example, to encrypt + +* the plaintext block `0x00112233445566778899aabbccddeeff` +* using AES-128 in ECB mode +* with key `0x000102030405060708090a0b0c0d0e0f`, + +run: + + aes_encrypt_block.exe -a aes128 -m ecb 000102030405060708090a0b0c0d0e0f 00112233445566778899aabbccddeeff + +To encrypt + +* the plaintext block `0x00112233445566778899aabbccddeeff` +* using AES-192 in OFB mode +* with initialization vector `0x22222222222222222222222222222222` +* and key `0x000102030405060708090a0b0c0d0e0f101112131415161718`, + +run: + + aes_encrypt_block.exe -a aes192 -m ofb 000102030405060708090a0b0c0d0e0f101112131415161718 22222222222222222222222222222222 00112233445566778899aabbccddeeff + +## aes_decrypt_block.exe + +Decrypts 16-byte blocks using AES-128/192/256 in the specified mode of operation. + +### Usage examples + +For example, to decrypt + +* the ciphertext block `0x69c4e0d86a7b0430d8cdb78070b4c55a` +* using AES-128 in ECB mode +* with key `0x000102030405060708090a0b0c0d0e0f`, + +run: + + aes_decrypt_block.exe -a aes128 -m ecb 000102030405060708090a0b0c0d0e0f 69c4e0d86a7b0430d8cdb78070b4c55a + +To decrypt + +* the ciphertext block `0x762a5ab50929189cefdb99434790aad8` +* using AES-192 in OFB mode +* with initialization vector `0x22222222222222222222222222222222` +* and key `0x000102030405060708090a0b0c0d0e0f101112131415161718`, + +run: + + aes_decrypt_block.exe -a aes192 -m ofb 000102030405060708090a0b0c0d0e0f101112131415161718 22222222222222222222222222222222 bda298884f5c3a9eb7068aa7063a3b75 diff --git a/test/aes_common.hpp b/utils/block/cxx/aes_common.hpp index 78126e5..78126e5 100644 --- a/test/aes_common.hpp +++ b/utils/block/cxx/aes_common.hpp diff --git a/test/aes_decrypt_block.cpp b/utils/block/cxx/aes_decrypt_block.cpp index 9898d4e..9898d4e 100644 --- a/test/aes_decrypt_block.cpp +++ b/utils/block/cxx/aes_decrypt_block.cpp diff --git a/test/aes_encrypt_block.cpp b/utils/block/cxx/aes_encrypt_block.cpp index 9458831..9458831 100644 --- a/test/aes_encrypt_block.cpp +++ b/utils/block/cxx/aes_encrypt_block.cpp |