Hi,

  I have a situation where I have a message that has been encrypted via
RSA_public_encrypt.  On the receiving end I have the n, p, q, dmp1,
dmq1, and iqmp components (I know it might sound odd that I don't have
the e and d components but that is the case).  I'm trying to do
something like:

 

If (!(new_key = RSA_new()))

   return -1;

 

new_key->n = BN_bin2bn(n_data, n_data_len, NULL);

new_key->p = BN_bin2bn(p_data, p_data_len, NULL);

new_key->q = BN_bin2bn(q_data, q_data_len, NULL);

new_key->dmp1 = BN_bin2bn(dmp1_data, dmp1_data_len, NULL);

new_key->dmq1 = BN_bin2bn(dmq1_data, dmq1_data_len, NULL);

new_key->iqmp = BN_bin2bn(iqmp_data, iqmp1_data_len, NULL);

 

resultDecrypt = RSA_private_decrypt(encrypted_size, encrypted,
decrypted, new_key, RSA_PKCS1_PADDING);

 

This decrypt fails with

error:0407106B:rsa routines:RSA_padding_check_PKCS1_type_2:block type is
not 02

 

Supplying the correct e and d component causes it work properly, but I
will not have those under normal circumstances.  Is there any way to do
this without d and e?

Reply via email to