eclipse - OpenSSL AES_set_encrypt_key crashes C++ program -


i trying use openssl aes encryption/decryption. code looks follows:

// buffers unsigned char encryptedbuffer[1024]; unsigned char outbuffer[1024];  unsigned char key[128/8]; memset(key, 0, sizeof(key));  aes_key enc; aes_key dec;  aes_set_encrypt_key(key, 128, &enc); aes_set_decrypt_key(key, 128, &dec);  unsigned char text[] = "hello world";  cout << text << endl;  aes_encrypt(text,encryptedbuffer,&enc); aes_decrypt(encryptedbuffer,outbuffer,&dec);  cout << outbuffer << endl; 

on compilation program crashes, giving windows message program stopt working. far have found out happens on call of aes_set_encrypt_key(key, 128, &enc); ideas doing wrong?

i using eclipse (mingw) on windows , have installed openssl 1.0.1i.

edit: linked openssl lib eclips going

  1. project >> properties >> c/c++ build >> settings
  2. under mingw c++ linker libraries
  3. under libraries (-l) includet libeay32 , ssleay32
  4. under library search path (-l) put path openssl lib file (c:\openssl-win64\lib)

i have seen in other forums lot of suggestions mentioned libs ssl , crypto. these not part of openssl instalation (windows).


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -