2013-02-27 77 views
2

是什麼OpenSSL中2種鍵類型之間的差異:OpenSSL中EVP_PKEY_RSA和EVP_PKEY_RSA2之間的區別?

1)EVP_PKEY_RSA

2)EVP_PKEY_RSA2

在庫中的2被定義爲:

#define EVP_PKEY_RSA NID_rsaEncryption 
#define EVP_PKEY_RSA2 NID_rsa 

此外, NID定義爲:

#define NID_rsaEncryption  6 
#define NID_rsa    19 

回答

2

兩者都是EVP_PKEY_RSA類型,然後覆蓋相同的rsa密鑰對,但在不同的上下文中使用不同的對象標識符PKCS1或X509證書。從*加密萃取

代碼行/對象/ obj_dat.h *

爲EVP_PKEY_RSA NID_rsaEncryption:

0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,/* [ 38] OBJ_rsaEncryption */  
{"rsaEncryption","rsaEncryption",NID_rsaEncryption,9,&(lvalues[38]),0}, 

是PKCS1 RSA加密1.2.840.113549.1.1.1

for EVP_PKEY_RSA2 NID_rsa

0x55,0x08,0x01,0x01,       /* [104] OBJ_rsa */ 
{"RSA","rsa",NID_rsa,4,&(lvalues[104]),0}, 

這是rsa加密X.500定義的算法id-ea-rsa 2.5.8.1.1