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
project >> properties >> c/c++ build >> settings
- under
mingw c++ linker
libraries
- under
libraries (-l)
includetlibeay32
,ssleay32
- 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
Post a Comment