(e,n) and (d,n)! But isn't the public key just a bunch of bits?

(e,n) and (d,n)! But isn't the public key just a bunch of bits?

After explaining the calculation of the (e,n) and (d,n) keys (see theory here), I got a question from a student who asked me that ... isn't the public key just a bunch of bits, and how does that relate to the public key (e,n) and the private key (d,n)?

And I thought about it, and it's a good question, as there is often a bit of disconnect in what you see as your key - a bit of bits - and the calculation of (e,n) - your public key - and (d,n) - your private key.

In the end, basically you give me your value of e (Exponent) and n (Modulus), and I take the message and raise it to the power of e, and the take MOD n (where MOD is the remainder of an integer divide). On the other side, I raise the value to the power of d (which is secret), and take MOD n, and I recover the message.

(e,n), (d,n), Modulus and Exponent

So your public key is (e,n) and the private key is (d,n). I send you my (e,n) value, and you take your message and raise it to the power of e, and then take the MOD of n, and send me the result. I then raise that to the power of d (which I have kept secret), and take MOD of n, and I've decryped it.

With the key we define that: Modulus is n, and the Exponent is e.

So the public key can be contained in ASCII format with (containing the Modulus and Exponent):

-----BEGIN PGP PUBLIC KEY BLOCK-----
 Version: GnuPG v2
 mQENBFTzi1ABCADIEWchOyqRQmU4AyQAMj2Pn68Sqo9lTPdPcItwo9LbTdv1YCFz
 w3qLlp2RORMP+Kpdi92CIhdUYHDmZfHZ3IWTBgo9+y/Np9UJ6tNGocrgsq4xWz15
 ...
 ssAIbCaBlQkzfbPvrMzdTIP+AXg6++K9SnO9N/FRPYzjUSEmpRp+ox31WymvczcU
 RmyUquF+/zNnSBVgtY1rzwaYi05XfuxG0WHVHPTtRyJ5pF4HSqiuvk6Z/4z3bw==
 =ZrP+
 -----END PGP PUBLIC KEY BLOCK-----

In XML, the Modulus (n) and Exponent (e) are defined with an XML tag (defined in Base64 format):

<RSAKeyValue>
<Modulus>rnBgffS0GgaNNw+SppdR084k3IwK9kkaP8cKWG1UmdLq9/f15w0uvbCW0bKhQV1my5RiVZ0tb0P4iEoyKcCcBQ==</Modulus>
<Exponent>AQAB</Exponent>
</RSAKeyValue>

Conclusions

Yes. The public key is a bunch of bits, but it's a special bunch of bits, with an e part (an Exponent) and an n part (the Modulus). The format that we use is either an ASCII one, or an XML one, but (e,n) is burried in there.

Here is some RSA theory:

要查看或添加评论,请登录

Prof Bill Buchanan OBE FRSE的更多文章

社区洞察

其他会员也浏览了