联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2025-11-08 06:41

1. [Marks: 25%] You are given the RSA public key and one ciphertext:

● Public key: PU = {e = 5, n = 735 984 598 043}.

● A ciphertext C which is the encryption of an unknown message M:

C=Me (mod n), C=650 404 468 666,

You may query a decryption oracle that returns the plaintext of any chosen ciphertext C'. except when C'= C (i.e., it returns Dec(C') for any C' you supply, except when C' =C)

Choose two appropriate odd values s and s2 and submit the ciphertexts  (mod n) and  (mod n). The oracle returns Dec(C1) and Dec(C2) Use either one of Dec(C1) and/or Dec(C2) to find the original message M. Submit all your work in a text, Word, or

2. [Marks: 25%] You are provided with an MD5 hash value and partial information about the original message y. You are given the hash MD5(y):

MD5(y)= h= b'\xb7\xd2v~w\xd4=\x86\xef\xf7\x84sv\xb0\xc7\x16'

It is known that y is a DES key (64 bits), with the first 48 bits being b'imagin'

Determine the last 16 bits (2 bytes) of y. Submit your code as q2.py (remember to include

3. [Marks: 25%] Message b'A heartfelt thank you to Galois and Fermat!' has been signed a number of times using RSA-PSS with the same private key, using the following code snippet:

message = b'A heartfelt thank you to Galois and Fermat!'

signature = private_key.sign(

message, 

padding.PSS(

mgf=padding.MGF1(hashes.SHA256()),

salt_length=padding.PSS.MAX_LENGTH

),

hashes.SHA256()

)

The corresponding public key in pem format is as follows:

b'-----BEGIN PUBLIC KEY-----

\nMIGfMAOGCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCpeGfrPlftac6CbipqMFde1YMm\nT 8dPyos 742KeZMeUqTDO5BsOV6Un5Ab8tM5o6VEVumOsg4D6rTO6HhCpouzXchV na38f OgKwQ5t9нЫTCLM3C/3brOJ1mGGeOUQAAEIK7NzoMlufJFKChCOg5VkuyjJX\n1iYn5aOcb VAXIAsQgwIDAQAB\nEND PUBLIC KEY-\n'

To use the public key above you will need to serialize the pem bytes as follows:

public_key= serialization.load_pem_public_key(pem_bytes)

From the following 10 signatures in Base64, find the ones that successfully verify the message. To prevent guessing, you can only get full marks for this question if you find ALL the valid signatures without errors. Submit your code as q3.py (remember to include the









版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp