aes

Wrong AES decryption when trying to decrypt in another language

僤鯓⒐⒋嵵緔 提交于 2019-12-10 21:13:19
问题 When I try to Encrypt in C++ and decrypt in C# it gives me an error The input data is not a complete block But It doesn't make any sence to me, because if I try to decrypt the message in C++, the same language as I made the encryption it works fine. So, some code from the C++ part: int main(int argc, char* argv[]) { std::string szEncryptionKey = "Sixteen byte key"; std::string szEncryptionIV = "Sixteen byte key"; std::string str = "I do not like green eggs and ham I do not like them Sam-I-Am.

Problems with AES in crypto-js and pycrypto

血红的双手。 提交于 2019-12-10 21:07:42
问题 I try to implement a communication between crypto-js (a javascript crypto library) and pycrypto (a python crypto library) On the python server side I encrypt a string with an iv and a passphrase and send the iv with the encrypted text base64 encoded to the javascript client side . Then I want to decrypt the string with the passphrase the user can enter. python - server from Crypto.Cipher import AES from Crypto import Random iv = Random.get_random_bytes(16) key = "1234567812345678" aes = AES

MYSQL | AES encrypt() / decrypt()

孤人 提交于 2019-12-10 20:24:09
问题 I need to encrypt a string in a decryptable way. Best way would be by a given password to get a little bit of protection in. Security isnt that important in here. I picked out AES_ENCRYPT() so far but cant decrypt it. Encrypt: SELECT AES_ENCRYPT('test', 'test') Output : 87bd903885943be48a4e68ab63b0ec6a Decrypt: SELECT AES_DECRYPT('87bd903885943be48a4e68ab63b0ec6a', 'test') Output : NULL ! Simple question: Why the hell can't I decrypt it? Couldnt find anything about it online. If the solutions

AES encrypt in .NET and decrypt with Node.js crypto?

我怕爱的太早我们不能终老 提交于 2019-12-10 20:12:30
问题 I'm trying to encrypt some data in Mono C#, send it to a NodeJS server and decrypt it there. I'm trying to figure out what algorithms to use to match the two. I send the encrypted string encoded with base64. So I do something like this in Javascript, where I know the key which was used to encrypt the data in my C# application: var decipher = crypto.createDecipher('aes192',binkey, biniv); var dec = decipher.update(crypted,'base64','utf8'); dec += decipher.final('utf8'); console.log("dec", dec)

AesManaged and RijndaelManaged

房东的猫 提交于 2019-12-10 20:12:28
问题 Im currently developing a Silverlight application that connects to an old webservice. Our old webservice uses an encryption tool which silverlight does not support. Finally, we decided to used AesManaged for encryption, however, our webservice does not support AesManaged. Is their a way to decrypt an AesManaged to RijndaelManaged? If yes, can you please post a sample snippet? Your feedback is highly needed. Thank you. 回答1: As long as you make sure to set the blocksize of RijndaelManaged to

Encrypt with openssl and decrypt on iPhone with AES 128, ecb mode

我的梦境 提交于 2019-12-10 20:08:25
问题 Update : found the solution. I will update this question soon with the actual working code and command. A client is encrypting a file server-side with C++, and I need to decrypt it in an iPhone application. My client can crypt and decrypt on his side, and so do I on the iPhone, but we can't decrypt the file encrypted by each other. I saw many related questions on SO, but none could help me find an implementation that works the same way on both side. I want to output some sample values that we

Is it safe to use PBKDF2 with SHA256 to generate 128-bit AES keys?

放肆的年华 提交于 2019-12-10 19:55:43
问题 I want to use PBKDF2 with some cryptographic hash function to generate 128-bit AES keys. SHA1 is also 128-bit, so I thought of using that with PBKDF2, but it was broken, so I have opted to use SHA256 instead. Is this safe, or will the difference between the hash size and resulting key size cause some sort of disastrous silent truncation that will render the AES keys weak? Should I just have it generate 256-bit keys for AES instead? 回答1: While SHA-1 is "broken", most reasonable systems only

Crypto++ output data length

ε祈祈猫儿з 提交于 2019-12-10 18:48:53
问题 I am trying to use AES encryption from Crypto++ libary: CBC_Mode<AES>::Encryption e; I have a binary data block that I need to encrypt. The class seems to provide a method called ProcessData for this purpose: virtual void ProcessData(byte *outString, const byte *inString, size_t length); Looks like the last parameter is the size of the input data. What is not clear is why the method does not return me the size of the encrypted data. Is it assumed that the size of output data block is exactly

MySQL aes_encrypt padding scheme?

社会主义新天地 提交于 2019-12-10 18:25:56
问题 Does anyone know what padding scheme mysql uses for their aes_encrypt? I've done a lot of googling, and all I found was "byte padding". But that's too general! Thanks 回答1: The data padding is done per RFC3369/PKCS#5. Keys are zero padded. Unfortunately, neither of these are documented, but I got the information from this bug report: http://bugs.mysql.com/bug.php?id=16713 回答2: Here's a good explanation with code that demonstrates how the padding works. 回答3: If you don't know what padding is

AES encryption result only part of data are correct (using mcrypt lib)

微笑、不失礼 提交于 2019-12-10 17:57:30
问题 I download a sample code of AES encryption from https://gist.github.com/2436364 I modified part of the source code to meet my project requirement as below: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <mcrypt.h> #include <math.h> #include <stdint.h> int encrypt(void* buffer, int buffer_len, char* IV, char* key, int key_len){ MCRYPT td = mcrypt_module_open("rijndael-128", NULL, "cbc", NULL); int blocksize = mcrypt_enc_get_block_size(td); if( buffer_len % blocksize != 0 )