Questions tagged [evp-cipher]

The EVP cipher routines are a high level interface to certain symmetric ciphers.

The EVP cipher routines are a high level interface to certain symmetric ciphers.

More details

69 questions
2
votes
0 answers

HsOpenSSL cipher result different from M2Crypto and command line?

I'm writing a program to interface with another program written in python. I find that the ciphered results are different. In ghci, with HsOpenSSL, the ciphered result is \GS\n\197: import OpenSSL import OpenSSL.EVP.Cipher import Data.Maybe method…
rnons
  • 363
  • 2
  • 10
1
vote
1 answer

Openssl C API "EVP_BytesToKey()" returns wrong key and iv when used

Using the OpenSSL C API , I want to decrypt a file using a password, in order to do that I need to manually derive the key and iv from the given password using EVP_BytesToKey() , but the function gives me the wrong key and iv. I encrypt the file…
user18909000
1
vote
0 answers

Encrypt with AES-128-CBC and Open SSL EVP (Language C)

I'm doing the following procedure to encrypt: EVP_CIPHER_CTX * ctx; if (! (ctx = EVP_CIPHER_CTX_new ())) handleErrors (); if (1! = EVP_EncryptInit_ex (ctx, EVP_aes_128_cbc (), NULL, key, InitializationVector)) handleErrors (); if (1! =…
FlaskDev
  • 25
  • 6
1
vote
1 answer

How to encrypt/decrypt using key index in OpenSSL EVP APIs?

My system includes a Hardware Secure module(HSM), which imports symmetric/asymmetric keys to its internal memory, then provides key index to outside users for future use(encrypt/decrypt). I'm now writing an OpenSSL engine for this HSM, which is…
yoyozi
  • 86
  • 6
1
vote
1 answer

How to decrypt using openssl EVP?

I'm trying to decrypt a file using C (but I can change to C++), but I don't know how to use the EVP library correctly. The console command that I want to replicate is: openssl enc -rc2-ecb -d -in myfile.bin -iter 1 -md sha1 -pbkdf2 -pass…
Latra
  • 492
  • 3
  • 14
1
vote
1 answer

Openssl EVP "EVP_CTRL_GCM_GET_TAG" fails

I am using Openssl EVP in C++. Somehow getting the tag failes. My Code: int do_crypt(FILE *in, FILE *out){ unsigned char inbuf[1024], aadbuf[1024], outbuf[1024 + EVP_MAX_BLOCK_LENGTH]; int inlen, lenbuf, unused, outlen; EVP_CIPHER_CTX…
root
  • 35
  • 5
1
vote
0 answers

RSA with custom engine openssl

I am looking to run this (URL)code with custom engine: https://sehermitage.web.fc2.com/program/src/rsa_evp.c I want to implement below functions with engine. EVP_PKEY_CTX_new(pkey, Engine e); EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE…
1
vote
0 answers

EVP_CipherInit_ex crash while not used, in decrypting password

The part of the code is on an android/ios common native libraries C++ code. Linking is agains OpenSSL 1.1.1 with version 1.0.# or previous, we used to have EVP_CIPHER_CTX ctx (not as a pointer) and we used to have EVP_CipherInit_ex but removed it…
thahgr
  • 718
  • 1
  • 10
  • 27
1
vote
0 answers

Openssl EVP API fails to decrypt ciphertext when it is read from file (AES 128 ecb)

i am trying to create a simple application that encrypts and decrypts a small file, < 10 bytes. I am using OpenSSL API of C (AES-128 ecb encryption) and i am encountering a strange "bug" when i encrypt a string and save it to a file. unsigned char…
1
vote
1 answer

Problem by Encryption & Decryption of text with EVP_des_ofb(), openSSL , C

I need to encrypt and decrypt txt-file with DES-ofb (libcrypto) using OpenSSL library, the key and Init Vector is given in one bin.file(key+iv). But after the decryption via EVP_DecryptUpdate(), decrypted text and plain text are not similar at all.…
grüBer
  • 25
  • 4
1
vote
1 answer

How might one fix evp_cipher_ctx and std::pair::second incomplete type errors?

I have been receiving the following compilation errors when running the following docker command in the picco, an MPC compiler, directory and after cloning the MPC-SoK/frameworks github repo: docker build -t picco . Forward declaration of 'struct…
z.karl
  • 295
  • 2
  • 12
1
vote
2 answers

How to detect wrong key used to decrypt openssl rc2-64-cbc nopad

I have some encrypted data, which is encrypted using rc2-64-cbc NO PADDING. I am able to decrypt fine. The issue : Even if the encrypted content is encrypted with wrong key my decryption doesn't error out, instead it decrypts to some garbage value,…
1
vote
1 answer

Can EVP_PKEY_encrypt input and output buffers be the same with RSA algorithm?

Can EVP_PKEY_encrypt input and output buffers be the same for RSA encrypt/decrypt? OpenSSL documentation neither explicitly denies nor allows to do it .
olegst
  • 1,209
  • 1
  • 13
  • 33
1
vote
1 answer

How to verify the digital signature given hash and public key?

There are plenty of examples written in C on how to verify a digital signature on a message but my use case requires me to provide only the message hash. So is there an alternative to EVP_DigestVerifyUpdate(mdctx, msg, strlen(msg)); where I could…
Jan Moritz
  • 2,145
  • 4
  • 23
  • 33
1
vote
1 answer

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

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…
Kingamere
  • 9,496
  • 23
  • 71
  • 110