OK, so after the last post I made; I was trying to use the DES library, and was advised to use the higher level EVP library, I have now used this and getting the same type of error! %-|
So where do I go from here. The command line that i wish to use for decrypting the file that i am encrypting is openssl des3 -d -nosalt -k "1" -in <source filename> -out <destination filename> The code that i am using to test these has two file streams, one for the input and one for the output and is shown below. This is test code only. What am i doing wrong here? Is it the key that is at fault. Please help... I also wish to use salt in the final implementation on this. Please advise... if(infile == NULL) AfxMessageBox("File load error"); fseek(infile, 0L, SEEK_END); numbytes = ftell(infile); fseek(infile, 0L, SEEK_SET); buffer = (char*)calloc(numbytes, sizeof(char)); fread(buffer, sizeof(char), numbytes, infile); unsigned char* input = new unsigned char[numbytes]; input = (unsigned char*)buffer; if(buffer == NULL) AfxMessageBox("Error with buffer"); unsigned char password[] = {'1'}; EVP_CIPHER_CTX ctx; EVP_CIPHER_CTX_init(&ctx); unsigned char* desBuf = new unsigned char[numbytes]; EVP_EncryptInit_ex(&ctx, EVP_des_ede3_cbc(), NULL,password,NULL); if(!EVP_EncryptUpdate(&ctx,desBuf,&outlen,input,numbytes)) { AfxMessageBox("error 1"); } if(!EVP_EncryptFinal_ex(&ctx, desBuf+ outlen, &tmplen)) { AfxMessageBox("error 2"); /* Error */ } EVP_CIPHER_CTX_cleanup(&ctx); outlen += tmplen; fwrite(desBuf, 1, outlen, outfile); fclose(outfile); fclose(infile); -- View this message in context: http://www.nabble.com/EVP-errors%21-tp24898590p24898590.html Sent from the OpenSSL - User mailing list archive at Nabble.com. ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org