Hello, Try to disable RSA blinding with:
RSA_blinding_off(new_key); before RSA_private_decrypt(). Best regards, -- Marek Marcola <marek.marc...@malkom.pl> owner-openssl-us...@openssl.org wrote on 02/24/2011 03:46:53 AM: > "Shaheed Bacchus (sbacchus)" <sbacc...@cisco.com> > Sent by: owner-openssl-us...@openssl.org > > 02/24/2011 03:52 AM > > Please respond to > openssl-users@openssl.org > > To > > <openssl-users@openssl.org> > > cc > > Subject > > RSA_private_decrypt without e and d > > 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? :��I"Ϯ��r�m���� (����Z+�K�+����1���x��h����[�z�(����Z+���f�y�������f���h��)z{,���