Hi Folks,
I was wondering if anyone had this problem.
Bascailly, I have got the OpenSSL toolkit, and am writing a test program in
C++ to encrypt a file.  I can successfully encrypt and decrypt a file using
this method.  The problem i have is if i encrypt a file using this program,
and use a command prompt to then try and decrypt the file, i get a bad
decrypt error message.

This is the command i am using.
openssl des3 -d -nosalt -k 1 -in "Testfile.xml" -outfile
"TestfileDecrypted.xml"

I am trying this out at present and doesnt work.  Eventually I will wish to
add salt in here as well.  The documentation is pretty loose to say the
least, and really could do with finishing this in the very near future, so
any comments would be greatly appreciated!

I am using the following code in C++

             DES_cblock key;
        const char* password = "1";

        DES_string_to_key(password, &key);

        DES_key_schedule ks[3];
        DES_cblock        m_ivec;
        DES_cblock        iv;
        long len = numbytes;

        memset(m_ivec, 0x00, 8);
        memcpy(iv, m_ivec, sizeof(m_ivec));

        unsigned char* input = new unsigned char[len];
        input = (unsigned char*)buffer;//

        unsigned char* desBuf = new unsigned char[len];
        memset(desBuf, 0x00, len);
        

        DES_set_odd_parity(&key);

        int nret = DES_set_key_checked(&key, &ks[0]);

        nret = DES_set_key_checked(&key, &ks[1]);
        nret = DES_set_key_checked(&key, &ks[2]);
        
        DES_ede3_cbc_encrypt(input,desBuf, len, &ks[0], &ks[1], &ks[2], &iv,
DES_ENCRYPT);

-- 
View this message in context: 
http://www.nabble.com/Problems-using-openssl-and-des3-in-toolkit-tp24863325p24863325.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [email protected]
Automated List Manager                           [email protected]

Reply via email to