I'm working on rsa private and public key / encryption / decryption / etc using openssl module. But a question is still unanswered : why private key are often (are always, i don't know) longer than public key ?
Is there several answer to this ?
This is my public and private key generated.
why private key are often (are always, i don't know) longer than public key ?
The answer is detailed in PKCS 1 (and friends like RFC 2437 ).
The public key is the pair {e, n}
, where e
is the public exponent and n
is the modulus.
One of the private key representations is the triplet {e, d, n}
, where e
is the public exponent, d
is the private exponent and n
is the modulus.
The other private key representations the n-tuple {e, d, n, p, q, dp, dq, qi}
, where e
is the public exponent; d
is the private exponent; n
is the modulus; and p
and q
are the factors of n
.
And the remaining are for the Chinese Remainder theorem, which allows a speedup in signatures (I believe). dp
is p's exponent, a positive integer such that e(dP) ≅ 1 (mod(p-1))
; dq
is q's exponent, a positive integer such that e(dq) ≅ 1 (mod(q-1))
; and qi
is CRT coefficient, a positive integer less than p
such that q(qInv) ≅ 1 (mod p)
.
The RSA private key includes the values that are in the RSA public key, and some more values that are private . Futhermore, the values themselves are larger.
The public key contains the modulus and the public exponent e which is short (mostly 3 or 65537). On the other hand the private key contains the private exponent d ≡ e −1 (mod φ( n )). Depending on φ( n ), d can be vastly larger than e .
There are other public key algorithms where this is different. Some algorithms based on elliptic curves have a single big integer as the private key (and group description) and the public key has a curve point (and group description) which is larger than the big integer.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.