RSA decryption without private exhibitor

I want to decrypt 1024-bit data that has been encrypted using RSA public key encryption. I have access to

public key modulus, public key exponent, prime p, prime q, exponent1 (d mod(p-1)), exponent2 (d mod(q-1)) and coefficient ( (1/q) mod p ) 

I do not have access to the private key metric. Is there a way to decrypt data without a private RSA member and all of these apis available? I use openssl for RSA to work. I heard that with a Chinese reminder, we only need p, q, exponent 1, exponent 2, and the coefficient for RSA decryption. But I am looking for apis in openssl. Is there any useful way in openssl to decrypt without a private exponent?

+4
source share
1 answer

Just check the openssl source to generate key pairs ...

 /* create r0, r1, r2, ctx and - of course - d */ /* calculate d */ if (!BN_sub(r1, p, BN_value_one())) goto err; /* p-1 */ if (!BN_sub(r2, q, BN_value_one())) goto err; /* q-1 */ if (!BN_mul(r0, r1, r2, ctx)) goto err; /* (p-1)(q-1) */ if (!BN_mod_inverse(d, e, r0, ctx)) goto err; /* d */ return d; 

You may need to generate some temporary variables above ...

+4
source

Source: https://habr.com/ru/post/1500129/


All Articles