You are on page 1of 4

Network Security-Exercise 3/5

June 8, 2020

Exercise 4 (1 Point, Exam Bonus Point)


a) Calculate the ciphertext C for p = 2699 and q = 1409 and e = 87 and M
= 782123. Subtract 10,000 from the resulting value C. Then calculate the
plaintext M’ for the updated ciphertext C.

ˆ Encryption operation of message M: C = E(M) = Me mod n

– n = p*q = (2699*1409) = 3802891


– C = 78212387 mod n
= 782123*78212386 mod n = 782123*(7821232 )43 mod n
= 782123* 235532443 mod n = 782123*2355324*(23553242 )21 mod
n
= 2249324*(235124)21 mod n = 2249324*235124*(2351242 )10 mod
n
= 2004806*(668909)10 mod n = 2004806*(6689092 )5 mod n
= 2004806*(2503894)5 mod n = 2004806*2503894*(25038942 )2 mod
n
= 1791673*(1031723)2 mod n = 1791673*2727939 mod n
= 263581
– Hence C is 263581

ˆ Subtracting 10,000 from C, we have 253581

ˆ Decryption operation of the updated ciphertext C: M’ = D(C) = Cd


mod n

1
– n: φ(n) = (p-1)*(q-1) (as p and q are prime)
– d = e−1 such that e*d = 1 mod φ(n)
d ≡e−1 mod φ(n)
d ≡ 1e mod φ(n)
d ≡ 1+modφ(n)
e
d = 1+kφ(n)
e
for the smallest k  N such that this expression is an
integral integer
for k = 1
d = 1+3798784
87
= 43664.1954
1+(2∗3798784)
d= 87
= 87328.3793, for k = 2
1+(3∗3798784)
d= 87
= 130992.563, for k = 3
...
d = 1+(38∗3798784)
87
= 1659239, for k = 38
Hence d = 1659239
– M’ = 2535811659239 mod n
Using the same approach we used to encrypt M, we have
– M’ = 2400527

(b) See code file :

ˆ refer to the code file for the solution

c) Find out the certificate chain that provides TLS for https://www.google.com,
and draw the chain of CAs that includes all intermediate CAs and the root
CA, specifying their organization names (O) and canonical names (CN).

ˆ Using the comand line: openssl s client -showcerts -connect www.google.com:443


</dev/null

ˆ Certificate chain

0 s : C = US, ST = California, L = Mountain View, O =


Google LLC, CN = www.google.com
i : C = US, O = Google Trust Services, CN = GTS CA
101

2
1 s : C = US, O = Google Trust Services, CN = GTS CA
101
i : OU = Globalisation Root CA - R2, O = GlobalSign,
CN = GlobalSign

– Common Name (CN)


– Organizational Unit Name (OU)
– Organization Name (O)
– Google LLC Locality Name (L)
– Mountain View State or Province Name (ST)
– Country Name (C): US
Root CA certificate
Root name : O = GlobalSign, CN = GlobalSign
*
Root public key: RSA (2048bits)
Root signature: sha1RSA
↓ verifies Issuer ↑
Intermediate certificate
Owner’s name: O = Google Trust Services, CN = GTS CA 101
Owner’s public key: RSA (2048bits)
Issuer’s (CA) name : O = GlobalSign, CN = GlobalSign
Issuer’s signature : sha1RSA

d) Extract the public key components (i.e. the exponent e and the modulus
n) from the X.509 certificate of www.tu-clausthal.de. Then use it to encrypt
the hexadecimal plaintext 011530. At last, provide the SHA3-256 hash of
the resulting ciphertext in hexadecimal representation.
ˆ By clicking on the lock in the address bar of my navigator-> View
certificate Dialog pops up with an "Export to File" button, which i use
to save the certificate as wwwtuclausthal.crt file.
ˆ Using the command line: openssl x509 -inform der -in wwwtu-
clausthal.crt -pubkey -noout > public key.pem, I copy the public
key in a .pem file
ˆ Using the command line: openssl rsa -pubin -in public key.pem
-text -noout, i obtain the exponent to be : 65537

3
ˆ Using the command line: openssl rsa -pubin -in public key.pem
-modulus -noout, i obtain the modulus in hexadecimal:
B3939225A8181110FDA5872889DC6B9FC97B108AE9B61
850460DC67E7220213F44A1CBC69A6669B34FBD5832335
8A7148B11938092F422E45942DD7754C8C2A9AAF0BAA5
D6EAD3F0C722AB634A0A7AAAF4D5AA514E615D4574C
96F648886597EB8C4975B342F1203AFCBA24EAB2B473C
16F068683E330B6326459700129DC894A16EE742EF0D27
4B3CA246A82E9128AF9A46151752F49B4416011C7161D9
1BD448CD3499D3347DAFDC1B9DEA164B330E14E6BF6
6E581308442A9480F74A96BF4F73D3543BE0ECB80F9600
F1B84B9A58BFE989CD992EE1827C0428AC4E9C19F069F
4E5AFD153E01CBAD251C5CE939CED2753395950DCA3
4525DBA0A1A0B301
ˆ The encryption operation of the hexadecimal plaintext 011530 is done
by using M: C = E(M) = Me mod n. Doing this we obtain the hex-
adecimal cipher :
– 2792b102456aa538807b30b8e2c2e67e02ffa5b78f61c
e205cc8e2e6d0cc51029f665bd1eb8b26fe888b2f1f098
ea7718296c178c95364194813df000bbfbbd7ead392ac
85434dd131802072e05ef5aab3c5e3876efbd23deeb77
e2be22cc7981a6070835c53c72ff686af711d330c737fd
c73ffd696109bd37db85ff5e6d6727dfd49e86f08de49a
f4a5c2ac5618e887599ee3e3b8fad102361989987c369
3097da951d2e49c7110ca4ef75ecb3741c2a72c917dcb
be54a00884842e3d804f21bf0bca88d85495b7062eab1
8d8e42c98da7799b9a1afdb189e14d6c715f87dd861c5
270236e48254e2ff1982ccac9dd6f6d17e7b247f844a32
784cf668940c0
ˆ See code file for the encryption.
ˆ The hash of the resulting ciphertext in hexadecimal representation is :
– SHA-3-256: 2916f4b43a9a01285ada14e9048ec
106a486c84ad6d7077604d58311be4e6e81
ˆ see code file for the hash

You might also like