Inputting a file address from a .text file to OpenSSL encryption function in C++?

  aes, c++, encryption, openssl

I want to direct multiple lines of output from a .txt file to that encrypt() function. The .txt file contains addresses of files I want to encrypt. The code compiles but no encryption pans out. I am using EVP_aes_256_cbc() for encryption. What am I doing wrong?

int encrypt(unsigned char* plaintext, int plaintext_len, unsigned char* key, unsigned char* iv, unsigned char* ciphertext);
int decrypt(unsigned char* ciphertext, int ciphertext_len, unsigned char* key, unsigned char* iv, unsigned char* plaintext);


int main() {
    unsigned char key[16];
    RAND_bytes(key, sizeof(key));

    unsigned char iv[16];
    RAND_bytes(iv, sizeof(iv));

    std::ifstream file("C:UsersNULLsourcereposxFolderYFoldertest.txt");
    std::string str;
    while (std::getline(file, str))
    {
        int encrypt(unsigned char* str, int plaintext_len, unsigned char* key,unsigned char* iv, unsigned char* ciphertext);
    } 

Source: Windows Questions C++

LEAVE A COMMENT