11.07.2015 Views

Cryptography - Sage

Cryptography - Sage

Cryptography - Sage

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

With a value of 128, the modulus is of size 2 128 , or about 39 decimal digits. Each of theprimes is of size approximately 20 decimal digits. This particular example can be easilybroken by the factorization:sage: x = K[0]; x86398677368792768067556452456311743331sage: x.factor()6046864213681032211 * 14288178850339607921Exercise 8.7 Use the above factorization to reproduce the private key L (generated but notprinted above) for this K.Solution.Given the factorization86398677368792768067556452456311743331= 6046864213681032211 · 14288178850339607921,we can find the inverse to the exponente = 49338921862830381807760291818994034053.sage: e = 49338921862830381807760291818994034053sage: p = 6046864213681032211sage: q = 14288178850339607921sage: d = inverse_mod(e,lcm(p-1,q-1))sage: d285484457605725559400259141876035917It is now possible to verify as above that (e, n) and (d, n) server as inverse RSA keys.Exercise 8.8 Why is the choice for which key is the public key and which key is theprivate key arbitrary? Practice encoding, decoding, enciphering, and deciphering with theRSA cryptosystem. Why do the member functions enciphering and deciphering returnthe same values?Solution.Provided that e is chosen as a random number in the range1 ≤ e ≤ lcm(p − 1, q − 1),127

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!