Two 64 The ciphertext of bits is multiplied to become 128 A cipher , Can the ciphertext be decrypted without the original private key , After executing the code written by yourself, the decryption fails all the time , Can't find the problem . The code is as follows : On the penultimate line , Decrypt m4 Has been decrypted unsuccessfully
import rsa
(pubkey, privkey) = rsa.newkeys(512)
pub = pubkey.save_pkcs1()
pri = privkey.save_pkcs1()
message = '18.234'.encode('utf-8')
m2='1.3'.encode('utf-8')
pubkey = rsa.PublicKey.load_pkcs1(pub)
privkey = rsa.PrivateKey.load_pkcs1(pri)
```python
crypto = rsa.encrypt(message, pubkey)```
m2 =rsa.encrypt(m2,pubkey)
print(crypto)
print(m2)
```python
crypto = int.from_bytes(crypto, byteorder='little', signed=True)
m2 = int.from_bytes(m2, byteorder='little', signed=True)```
print(crypto)
print(m2)
m3=crypto*m2
print(m3)
```python
crypto = crypto.to_bytes(64, byteorder='little', signed=True)
m2 = m2.to_bytes(64, byteorder='little', signed=True)
m3 = m3.to_bytes(128, byteorder='little', signed=True)
print(crypto)
print(m2)
length=len(m3)
m4=m3[0:64]
m5=m3[64:length]
message = rsa.decrypt(crypto, privkey)
m2 = rsa.decrypt(m2, privkey)
m4 = rsa.decrypt(m4, privkey)
m5 = rsa.decrypt(m5, privkey)
print(message.decode('utf-8'))
print(m2.decode('utf-8'))```
print(m4.decode('utf-8'))
print(m5.decode('utf-8'))
You should comment out this one , try m5 Can it be decrypted successfully , If m5 Also decryption error , That is, interception is wrong
Jane Medium : This paper gives
A powerful and easy-to-use mac