자료.예 암호화 ++
좋은 점 : 이해하기 쉽습니다 (이동 중에도 공부할 때의 기본 사항).
자료.예 암호화 ++
좋은 점 : 이해하기 쉽습니다 (이동 중에도 공부할 때의 기본 사항).
Crypto++ AES의 공식 문서는 좋은 시작입니다. 그리고 내 아카이브에서 AES의 기본 구현은 다음과 같습니다 :
here 자세한 설명을 참조하십시오. 먼저 algorithm을 이해하고 각 단계를 단계별로 이해하는 것이 좋습니다. 설치 자세한 내용은
#include <iostream>
#include <iomanip>
#include "modes.h"
#include "aes.h"
#include "filters.h"
int main(int argc, char* argv[]) {
//Key and IV setup
//AES encryption uses a secret key of a variable length (128-bit, 196-bit or 256-
//bit). This key is secretly exchanged between two parties before communication
//begins. DEFAULT_KEYLENGTH= 16 bytes
byte key[ CryptoPP::AES::DEFAULT_KEYLENGTH ], iv[ CryptoPP::AES::BLOCKSIZE ];
memset(key, 0x00, CryptoPP::AES::DEFAULT_KEYLENGTH);
memset(iv, 0x00, CryptoPP::AES::BLOCKSIZE);
//
// String and Sink setup
//
std::string plaintext = "Now is the time for all good men to come to the aide...";
std::string ciphertext;
std::string decryptedtext;
//
// Dump Plain Text
//
std::cout << "Plain Text (" << plaintext.size() << " bytes)" << std::endl;
std::cout << plaintext;
std::cout << std::endl << std::endl;
//
// Create Cipher Text
//
CryptoPP::AES::Encryption aesEncryption(key, CryptoPP::AES::DEFAULT_KEYLENGTH);
CryptoPP::CBC_Mode_ExternalCipher::Encryption cbcEncryption(aesEncryption, iv);
CryptoPP::StreamTransformationFilter stfEncryptor(cbcEncryption, new CryptoPP::StringSink(ciphertext));
stfEncryptor.Put(reinterpret_cast<const unsigned char*>(plaintext.c_str()), plaintext.length() + 1);
stfEncryptor.MessageEnd();
//
// Dump Cipher Text
//
std::cout << "Cipher Text (" << ciphertext.size() << " bytes)" << std::endl;
for(int i = 0; i < ciphertext.size(); i++) {
std::cout << "0x" << std::hex << (0xFF & static_cast<byte>(ciphertext[i])) << " ";
}
std::cout << std::endl << std::endl;
//
// Decrypt
//
CryptoPP::AES::Decryption aesDecryption(key, CryptoPP::AES::DEFAULT_KEYLENGTH);
CryptoPP::CBC_Mode_ExternalCipher::Decryption cbcDecryption(aesDecryption, iv);
CryptoPP::StreamTransformationFilter stfDecryptor(cbcDecryption, new CryptoPP::StringSink(decryptedtext));
stfDecryptor.Put(reinterpret_cast<const unsigned char*>(ciphertext.c_str()), ciphertext.size());
stfDecryptor.MessageEnd();
//
// Dump Decrypted Text
//
std::cout << "Decrypted Text: " << std::endl;
std::cout << decryptedtext;
std::cout << std::endl << std::endl;
return 0;
}
: 우분투를 들어
sudo apt-get install libcrypto++-dev libcrypto++-doc libcrypto++-utils
당신이를 사용하는 방법을 이해 하시겠습니까 라이브러리 또는 알고리즘의 기초? –
@MatteoItalia 프로젝트를 위해 AES를 사용해야하므로 라이브러리를 반드시 학습해야합니다 (프로젝트 기한 때문에). 그러나 내가 길을 따라 약간의 지식을 훔칠 수 있다면 좋을 것입니다! – Yohannes
http://www.cryptopp.com/wiki/Advanced_Encryption_Standard –