RSA Algorithm Functions (MBX)
RSA Notation
The following description uses PKCS #1 v2.1: RSA Cryptography Standard conventions:
n- RSA moduluse- RSA public exponentd- RSA private exponent,e*d = mod lambda(n), lambda(n) = LCM(n, e)- RSA public keya pair
(n, d)- so-called 1-st representation of the RSA private keyp, q- two prime factors of the RSA modulusn, n = p*qdP- thep’s CRT exponent,e*dP = 1 mod(p-1)dQ- theq’s CRT exponent,e*dQ = 1 mod(q-1)qInv- the CRT coefficient,q*qInv = 1 mod(p)a quintuple
(p, q, dP, dQ, qInv)- so-called 2-nd representation of the RSA private key
All the numbers above are positive integers.
Keep in mind the following assumptions:
Current implementation supports RSA-1024, RSA-2048, RSA-3072 and RSA-4096 (the number denotes size of RSA modulus in bits)
Public exponent is fixed, e=65537
No specific assumption relatively “
d”, except bitsize(d) ~ bitsize(n) andd<nSize of
pandqin bits is approximately the same and equals bitsize(n)/2
RSA public key operation
y = xemod n, x and y are plane- and ciphertext
correspondingly
RSA private key (1-st representation) operation
x = ydmod n, y and x are cipher- and plaintext
correspondingly
RSA private key (2-nd representation) operation or CRT-based RSA private key operation
x1 = ydPmod p
x2 = ydQmod q
t = (x1-x2) * qInv mod p
x = x2 + q*t