aes

Problems with CryptoPP C++ AES-256+Base64

筅森魡賤 提交于 2019-12-25 17:18:06
问题 could someone please tell me as to why the decryption starts to mess up. It works fine with short strings but it will mess up as you can see as it goes on. I THINK it has something to do with the string conversions. std::string encrypt(const std::string& str_in, const std::string& key, const std::string& iv) { std::string str_out; CryptoPP::CFB_Mode<CryptoPP::AES>::Encryption encryption((byte*)key.c_str(), key.length(), (byte*)iv.c_str()); CryptoPP::StringSource encryptor(str_in, true, new

why AES encryption is faster than Decryption

半世苍凉 提交于 2019-12-25 17:17:23
问题 I developed an encrypion system using AES, as i read, AES is symmetric and thus it takes the same period of time to encrypt and decrypt a particular file .. in my case, i got encryption time shorter than decryption time eventhough I iterate the encryption and decryption for the same file more than 20 times. any justiication why am I getting different time for encryption or decryption ?! 回答1: Symmetric points to the fact that it uses the same key to encrypt and decrypt, and has nothing to do

Encrypt file with AES-256 and Decrypt file to its original format

别等时光非礼了梦想. 提交于 2019-12-25 14:13:25
问题 I have to build a project for encryption and decryption of files in AES-256. So, I have to encrypt files and those files could be of any format like text file, image file, video file or any kind of file with any format, And have to encrypt those files and store them on device with different format like *.anuj (extension name). Suppose I encrypted file and made new file with custom extension. While decryption that file how am I supposed to know that original file was text file or image or of

C++ AES encrypt bigger string than 128bits

﹥>﹥吖頭↗ 提交于 2019-12-25 14:06:10
问题 AES has maximum block size of 128, and key sizes like 128, 196 & 256. I have implemented the aes algorithm like so: int main() { unsigned char key[KEY_128] = "very strong key"; unsigned char plaintext[16] = "this is a test"; unsigned char ciphertext[16]; unsigned char decptext[16]; aes_ctx_t *ctx; virtualAES::Initialize(); ctx = virtualAES::AllocateCTX(key, sizeof(key)); virtualAES::Encrypt(ctx, plaintext, ciphertext); cout << "encrypted: " << ciphertext << endl; virtualAES::Encrypt(ctx,

Incompatible AES implementations?

纵然是瞬间 提交于 2019-12-25 11:01:12
问题 I've compiled some AES implementation code from this site, it's supposed to perfrom a 128 bits key encryption. I tested the encryption/decryption programs which work OK together. However if I encrypt anything with the mentioned code and then try to decrypt it by openssl tool built-in in linux, I just can't get decrypt it, it even logs me the bad magic number error. Same, if I encrypt anything with openssl and try to decrypt with the code won't work. I tried with both cbc ecb. If they're both

Access to the path is denied on File.ReadAllBytes on AES encrypted file

末鹿安然 提交于 2019-12-25 10:50:10
问题 I am trying to read the binary contents of a file with File.ReadAllBytes and getting the exception that access to the file is denied. Do I have to open the file first? Its taking the exception path in this try-catch and displaying. Unable to load configuration data. Access to the path 'c:\worl\Project Alpha\Code\AlphaBackendService\AlphaBackendService\bin\Debug\alphaService.xml' is denied. What am I missing? try { string path = AppDomain.CurrentDomain.BaseDirectory; eventLog1.WriteEntry(path)

Identifying an AES encrypted file

前提是你 提交于 2019-12-25 09:12:07
问题 Is there a way to identify or inspect an AES encrypted file based on the file content (like the way a ZIP file can be identified by looking for letters "PK" at the beginning of the file)? Is there any magic number associated with AES encrypted files? We have multiple files in the workflow repository that are either in plain text (could be excel, XML, JSON, text etc.) or AES-256 encrypted and don't have an idea which ones are AES encrypted. I need to write Java code to identify the AES

AES-256 CBC encryption succeeds in Ruby/PHP, but decryption fails with CryptoJS

≯℡__Kan透↙ 提交于 2019-12-25 07:59:40
问题 I can AES-256 CBC encrypt a string in PHP or Ruby (using the gem symmetric-encryption) and get the same result. <?php openssl_encrypt( 'Hello!', 'aes-256-cbc', '1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF', 0, '1234567890ABCDEF1234567890ABCDEF' ); // => 'BAd5fmmMTvRE4Ohvf3GpCw==' ruby_cipher = SymmetricEncryption::Cipher.new(key: "1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF", iv: "1234567890ABCDEF1234567890ABCDEF", cipher_name: 'aes-256-cbc') ruby

AES | Encrypt with OpenSSL, decrypt with mcrypt

五迷三道 提交于 2019-12-25 05:27:37
问题 I am using the following function to encrypt my data via the OpenSSL Library in Qt: QByteArray Crypto::Encrypt(QByteArray source, QString password) { EVP_CIPHER_CTX en; unsigned char *key_data; int key_data_len; QByteArray ba = password.toLatin1(); key_data = (unsigned char*)ba.data(); key_data_len = strlen((char*)key_data); int nrounds = 28; unsigned char key[32], iv[32]; EVP_BytesToKey(EVP_aes_256_cbc(), EVP_sha1(), NULL, key_data, key_data_len, nrounds, key, iv); QByteArray bkey =

AES Encryption and Obfuscating IDs

女生的网名这么多〃 提交于 2019-12-25 05:26:15
问题 I was considering hashing small blocks of sensitive ID data but I require to maintain the full uniqueness of the data blocks as a whole once obfuscated. So, I came up with the idea of encrypting some publicly-known input data (say, 128 bits of zeroes), and use the data I want to obfuscate as the key/password, then throw it away , thus protecting the original data from ever being discovered. I already know about hashing algorithms, but my problem is that I need to maintain full uniqueness