[openssl-users] Chinese remainder algorithm

Jan Bilek ian.bilek at gmail.com
Tue Jul 31 10:49:21 UTC 2018

Hi all,

I need to reconstruct public and private keys for data signing operation
from p, q, dmp1, dmq1 and iqmp. When I fill values in as per below then
OpenSSL complains about missing d.

    RSA* pkey = RSA_new();
    pkey->n = NULL;
    pkey->e = NULL;
    pkey->d = NULL;

    pkey->p    = BN_bin2bn(secureP.data(), secureP.size(), NULL);
    pkey->q    = BN_bin2bn(secureQ.data(), secureQ.size(), NULL);
    pkey->dmp1 = BN_bin2bn(secureDmp1.data(), secureDmp1.size(), NULL);
    pkey->dmq1 = BN_bin2bn(secureDmq1.data(), secureDmq1.size(), NULL);
    pkey->iqmp = BN_bin2bn(secureIqmp.data(), secureIqmp.size(), NULL);

I did my homework on Google/Stackoverflow/OpenSSL docu, but I haven't been
able to find out any good way to do this, while it is obvious that openssl
needs to know this by deafult for its internals.
Would you have any hint on where next with this?

Thank you,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20180731/bb2f3bdf/attachment-0001.html>

More information about the openssl-users mailing list