0

Can anybody tell me, how to get p,q,dp,dq and u component of rsa private key? loading of the key:

string = open(keyfile,"rb").read();
bio = BIO.MemoryBuffer(string);
rsa = RSA.load_key_bio(bio);

what shall i do next?

Torto
  • 1

1 Answers1

0

M2Crypto does not support reading the rsa parameters directly, sorry.

you can kind of get e (public exponend) and n (modulus) from res.pub() (kind of, because the first bytes are not part of it).

the Crypto API on the other hand supports reading more parameters:

string = open(keyfile,"rb").read()
import Crypto.PublicKey.RSA
crsa = Crypto.PublicKey.RSA.importKey(string)
print(crsa.n, crsa.e, crsa.d, crsa.p, crsa.q, crsa.u)
mata
  • 67,110
  • 10
  • 163
  • 162