Hi! I am trying to convert my code of 3DES encoding from Windows CryptoAPI to OpenSSL. Could you verify the code attached and may be point me to appropriate OpenSSL functions?
///////////////////////////////////////////////// //////////////////////////////////////////////// // Windows CryptoAPI // OpenSSL // HCRYPTPROV hProv; // CryptAcquireContext(&hProv, NULL, // MS_ENHANCED_PROV, PROV_RSA_FULL, // CRYPT_VERIFYCONTEXT)); // // HCRYPTHASH hHash; // CryptCreateHash(hProv, CALG_MD5, 0, 0, &hHash); // // unsigned char *user_key, ukeyl; // CryptHashData(hHash, user_key, ukeyl, 0); // // // // 192-bit or 24-byte key length // unsigned char *user_key, user_key_len; const unsigned int derived_key_len = 0xC0 << 0x10; // unsigned char *derived_key, derived_key_len; // unsigned char *iv = NULL; HCRYPTKEY hKey; // CryptDeriveKey(hProv, CALG_3DES, // derived_key_len = EVP_BytesToKey( hHash, derived_key_len, &hKey); // EVP_des_ede3_cbc(), EVP_md5(), NULL, // user_key, user_key_len, 1, // derived_key, iv); // // EVP_CIPHER_CTX ctx = {}; // EVP_EncryptInit(&ctx, // EVP_des_ede3_cbc(), derived_key, iv); // const unsigned char* text; // const unsigned char* text; int encoded_len; // unsigned char* encoded; bool FinalBlock = false; // int text_len, encoded_len; // CryptEncrypt(hKey, 0, FinalBlock, 0, // EVP_EncryptUpdate(&ctx, text, &encoded_len, 1024); // encoded, &encoded_len, text, text_len); // FinalBlock = true; // CryptEncrypt(hKey, 0, FinalBlock, 0, // EVP_EncryptFinal_ex(&ctx, text, &encoded_len, 1024); // encoded + encoded_len, NULL); -- View this message in context: http://www.nabble.com/DES3%3A-Windows-CryptoAPI-and-OpenSSL-tf4689809.html#a13403663 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 [EMAIL PROTECTED]