Cryptography Reference
In-Depth Information
> RSADecrypt := proc(privatekey::list, ciphertext::list, posint, string)
local sk, hexsize, c, plaintext;
if type(privatekey[1], string) then
sk := convert (privatekey, decimal, hex)
else
sk := privatekey
end if;
if type(ciphertext, string) then
hexsize := intlog[16](sk[1])+1;
c := [StringTools:-LengthSplit(ciphertext, hexsize)];
c := convert (c, decimal, 16)
elif type(ciphertext, posint) then
c := [ciphertext]
else
c := ciphertext
end if;
plaintext :=
chrem([Power (c, sk[5]) mod sk[3], Power (c, sk[6]) mod sk[4]],
[sk[3], sk[4]]);
convert(ListTools:-Flatten(convert (plaintext, base, 256)), bytes)
end proc:
Example 8.4 We decrypt the ciphertext ctxt obtained in Example 8.3 with the
private key sk of Example 8.2. The result is the following:
> RSADecrypt(sk, ctxt);
"The great struggle in cryptology during the final quarter century of the
millennium came over openness. A field that had for centuries been a
secret government monopoly exploded into public consciousness under the
impact of technology, economics, politics, and history.
David Kahn, in 'The Codebreakers' - Chap. 27 (Cryptology goes public)."
Exercise 8.14 Modify the function RSADecrypt in order that it uses only the
(public) modulus and the decryption exponent, i.e., the two first terms of a private
key in the format of RSAKeyGen .
Exercise 8.15 Modify the function RSADecryt so that it uses Eq. 8.1 to perform
decryption. For this, the terms 3-8 of the private key list will be needed.
8.3.4 Security of RSA
We shall now discuss in more detail the security properties of RSA. We start with
an attack that gives a total break of RSA encryption as it allows an eavesdrop-
per to recover the private key from the public key. Fortunately, the attack requires
the decryption exponent to be small, which is easily avoidable. Nonetheless, as we
mentioned when discussing the practical aspects of RSA in 8.3.2 , this has specific
consequences as it precludes the possibility of choosing the decryption exponent
small for efficiency reasons.
 
Search WWH ::




Custom Search