You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"""Generate a private key with modulus 'bits' bit big.
key_type can be "rsa" for a universal rsaEncryption key or
"rsa-pss" for a key that can be used only for RSASSA-PSS."""
key=Python_RSAKey()
p=getRandomPrime(bits//2, False)
q=getRandomPrime(bits//2, False)
ifgmpyLoadedorGMPY2_LOADED:
p=mpz(p)
q=mpz(q)
t=lcm(p-1, q-1)
key.n=p*q
ifgmpyLoadedorGMPY2_LOADED:
key.e=mpz(65537)
else:
key.e=65537
key.d=invMod(key.e, t)
key.p=p
key.q=q
key.dP=key.d% (p-1)
key.dQ=key.d% (q-1)
key.qInv=invMod(q, p)
key.key_type=key_type
returnkey
perform the same operations. generate() could be reduced to calculating just p, q, n, and selecting e, passing them to Python_RSAKey constructor, so that __init__ calculates the d, dP, dQ, and qInv.
The text was updated successfully, but these errors were encountered:
The code in
__init__
:tlslite-ng/tlslite/utils/python_rsakey.py
Lines 16 to 54 in 9951ec1
and the code in
generate()
:tlslite-ng/tlslite/utils/python_rsakey.py
Lines 110 to 135 in 9951ec1
perform the same operations.
generate()
could be reduced to calculating justp
,q
,n
, and selectinge
, passing them toPython_RSAKey
constructor, so that__init__
calculates thed
,dP
,dQ
, andqInv
.The text was updated successfully, but these errors were encountered: