2017-09-27 155 views

回答

1

您還應該使用EVP_*函數;而不是像DES_ede3_cbc_encrypt(和朋友)那樣的功能。請參閱OpenSSL wiki上的EVP Symmetric Encryption and Decryption

要回答有關DES符號的問題,您需要使用EVP_des_XXX,其中XXX是感興趣的模式。我猜你想要EVP_des_cbc

如果您正在使用FIPS版本爲OpenSSL 的CentOS計算機,則您可能無法訪問任何DES或2鍵3DES算法(3鍵3DES應爲可用)。

$ cd openssl 
$ grep EVP_des include/openssl/evp.h 
const EVP_CIPHER *EVP_des_ecb(void); 
const EVP_CIPHER *EVP_des_ede(void); 
const EVP_CIPHER *EVP_des_ede3(void); 
const EVP_CIPHER *EVP_des_ede_ecb(void); 
const EVP_CIPHER *EVP_des_ede3_ecb(void); 
const EVP_CIPHER *EVP_des_cfb64(void); 
const EVP_CIPHER *EVP_des_cfb1(void); 
const EVP_CIPHER *EVP_des_cfb8(void); 
const EVP_CIPHER *EVP_des_ede_cfb64(void); 
const EVP_CIPHER *EVP_des_ede3_cfb64(void); 
const EVP_CIPHER *EVP_des_ede3_cfb1(void); 
const EVP_CIPHER *EVP_des_ede3_cfb8(void); 
const EVP_CIPHER *EVP_des_ofb(void); 
const EVP_CIPHER *EVP_des_ede_ofb(void); 
const EVP_CIPHER *EVP_des_ede3_ofb(void); 
const EVP_CIPHER *EVP_des_cbc(void); 
const EVP_CIPHER *EVP_des_ede_cbc(void); 
const EVP_CIPHER *EVP_des_ede3_cbc(void); 
const EVP_CIPHER *EVP_desx_cbc(void); 
const EVP_CIPHER *EVP_des_ede3_wrap(void); 

這裏有一些引用我一直走那兒剽竊加入OpenSSL和Java的互操作。通常EVP_BytesToKey會導致一些問題。

+0

我用'DES_ncbc_encrypt',和它運作良好,在解密將被Java的DES/CBC/PKCS5Padding加密密碼。 – Edure