[openssl-users] Chinese remainder algorithm

Thulasi Goriparthi thulasi.goriparthi at gmail.com
Wed Aug 1 09:32:28 UTC 2018

Hello Jan,

Decide on what your public exponent(e) should be, and either use
RSA_X931_derive_ex() if you are using an older openssl which supports
this function or follow rsa_builtin_keygen() from crypto/rsa/rsa_gen.c
on how to derive private exponent(d) and modulus(n).

By the way, technically, you do not need private exponent(d) for
signing, as you already have CRT components.

What is the function that complained about missing d?


On 31 July 2018 at 16:19, Jan Bilek <ian.bilek at gmail.com> wrote:
> 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,
> Jan
> --
> openssl-users mailing list
> To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users

More information about the openssl-users mailing list