a85b08f050
* Changing files but having issues with space tabs. * Removed config. Fixed indents. * Removed config. * Fixed test config. Fixed syntax in cli. * Editing cli and hub to finally commit transactions. * Added better logging logic. Will clean up in the morning. * Hub is more functional. * Edited IoT to gen keys. * Public keys are now generated, sent, and stored. However, they are not transmitted when a new client joins. * Added crypto testing * Communication is now functional.
34 lines
734 B
Python
34 lines
734 B
Python
"""
|
|
oh no
|
|
|
|
@author hornetfighter515
|
|
"""
|
|
import rsa
|
|
|
|
print('Generating keys...')
|
|
|
|
(pub_one, priv_one) = rsa.newkeys(2048)
|
|
(pub_two, priv_two) = rsa.newkeys(2048)
|
|
(pub_three, priv_three) = rsa.newkeys(2048)
|
|
|
|
print('Keys generated!')
|
|
|
|
message = 'hello world'
|
|
|
|
e_one = rsa.encrypt(message.encode(), pub_one)
|
|
e_two = rsa.encrypt(e_one[:128], pub_two)
|
|
e_three = rsa.encrypt(e_one[128:], pub_three)
|
|
|
|
print('Successfully encrypted!')
|
|
|
|
d_three = rsa.decrypt(e_three, priv_three)
|
|
d_two = rsa.decrypt(e_two, priv_two)
|
|
print(str(e_one))
|
|
print('-----------------------------')
|
|
print(str(d_two + d_three))
|
|
print(str(e_one) == str(d_two + d_three))
|
|
|
|
d_one = rsa.decrypt(d_two + d_three, priv_one)
|
|
|
|
print('Successfully decrypted ' + d_one.decode())
|