evp-cipher

Undefined reference to EVP_idea_ecb on Debian

本秂侑毒 提交于 2020-01-24 22:08:48
问题 I have the following code: #include <stdio.h> #include <stdlib.h> #include <openssl/evp.h> int main (int argc, char *argv[]) { EVP_CIPHER *cipher; EVP_idea_ecb(); } I know, this is not much, but it should compile without complaints, but I get gcc Testfile.c -lssl -lcrypto Testfile.c:(.text+0xec): undefined reference to `EVP_idea_ecb' gcc Testfile.c -lss /usr/bin/ld: /tmp/ccgbkhFA.o: undefined reference to symbol 'EVP_CIPHER_iv_length@@OPENSSL_1.0.0' //usr/lib/x86_64-linux-gnu/libcrypto.so.1.0

Undefined reference to EVP_idea_ecb on Debian

*爱你&永不变心* 提交于 2020-01-24 22:08:42
问题 I have the following code: #include <stdio.h> #include <stdlib.h> #include <openssl/evp.h> int main (int argc, char *argv[]) { EVP_CIPHER *cipher; EVP_idea_ecb(); } I know, this is not much, but it should compile without complaints, but I get gcc Testfile.c -lssl -lcrypto Testfile.c:(.text+0xec): undefined reference to `EVP_idea_ecb' gcc Testfile.c -lss /usr/bin/ld: /tmp/ccgbkhFA.o: undefined reference to symbol 'EVP_CIPHER_iv_length@@OPENSSL_1.0.0' //usr/lib/x86_64-linux-gnu/libcrypto.so.1.0

OpenSSL EVP API: How to decrypt the encrypted file using a symmetric key file

我们两清 提交于 2019-12-20 04:52:35
问题 Hi I'm working on C on Linux. I have a query related to symmetric key decryption. I have generated an symmetric key using the below command. openssl rand base64 512 > sym.key Using this key ( sym.key ) I have encrypted a file with below command. openssl enc -aes-256-cbc -in temp.txt -out temp.enc -kfile sym.key It has generated an encrypted file temp.enc . Now, I have to use the same key ( sym.key ) with EVP Decrypt API's and have to decrypt this encrypted file. Could any one suggest me a

Intermittent decryption failures in EVP_DecryptFinal_ex when using AES-128/CBC

倾然丶 夕夏残阳落幕 提交于 2019-12-12 05:27:26
问题 I am using the EVP library found here: https://www.openssl.org/docs/manmaster/crypto/EVP_EncryptInit.html Here are my two encryption and decryption functions: I am trying to encrypt a string using AES 128 CBC. The string is usually of the format word1 word2 word3 char* encrypt(char *s, char *key) { unsigned char iv[16] = {[0 ... 15 ] = 0}; unsigned char outbuf[1024] = {[0 ... 1023] = 0}; int outlen1, outlen2; EVP_CIPHER_CTX ctx; EVP_CIPHER_CTX_init(&ctx); EVP_EncryptInit_ex(&ctx, EVP_aes_128

OpenSSL EVP_DecryptFinal_ex returns “wrong final block length” error when decrypting a file

僤鯓⒐⒋嵵緔 提交于 2019-12-11 17:15:44
问题 I am using the EVP Symmetric Encryption and Decryption algorithm to encrypt and decrypt a file of text. The encryption works file, a new encrypted file is generated, but when I try to decrypt the file back it always crashes when EVP_DecryptFinal_ex is called the first time. I am using two Visual Studio projects: one for encryption and one for decryption. The libraries I am using I presumed they are build in DEBUG mode (because they have the .pdb files), so that is how my project is also build

OpenSSL EVP API: How to decrypt the encrypted file using a symmetric key file

前提是你 提交于 2019-12-02 04:25:26
Hi I'm working on C on Linux. I have a query related to symmetric key decryption. I have generated an symmetric key using the below command. openssl rand base64 512 > sym.key Using this key ( sym.key ) I have encrypted a file with below command. openssl enc -aes-256-cbc -in temp.txt -out temp.enc -kfile sym.key It has generated an encrypted file temp.enc . Now, I have to use the same key ( sym.key ) with EVP Decrypt API's and have to decrypt this encrypted file. Could any one suggest me a better approach for this. Here is the code unsigned char* decode (unsigned char *key, int len) { BIO *b64,

EVP Interface with AES-NI support

淺唱寂寞╮ 提交于 2019-11-27 07:06:57
问题 When using the OpenSSL crypto libraries in C/C++, does the EVP interface automatically support AES-NI hardware acceleration (assuming processor support)? Referring to this, it appears command-line OpenSSL does have support. I was wondering if there were specific function calls that I had to use to take advantage of this support. For instance, if I use EVP_EncryptInit_ex(ctx, type, imp, key, iv) , do any of these parameters have to specify NI acceleration? I.e. will EVP_EncryptInit_ex(ctx, EVP