-1

I am using ECDH for encryption and decryption as in network i create 3 nodes sensor server and sink. i am encrypting data at sensor and want to decrypt it at server. from tinyec import registry import secrets

` '# The elliptic curve which is used for the ECDH calculations curve = registry.get_curve('brainpoolP256r1')

Ka = secrets.randbelow(curve.field.n)
X = Ka * curve.g 

Kb = secrets.randbelow(curve.field.n)
Y = Kb * curve.g 
print("Currently exchange the publickey (e.g. through Internet)")

A_SharedKey = Ka * Y
B_SharedKey = Kb * X``

i am using this code + encryption algorithm code in sensor.py file to encrypt data but at server file i am unable to decrypt data due to B_SharedKey i want to know that how can i access this B_SharedKey in server file from sensor file i try to send it to server file but output shows that i have to convert it into str and concatenate with other arguments but its not working as i passed it .... B_SharedKey type is point and how can i access it as it is in server file from sensor file

iam using this code + encryption algorithm code in sensor.py file to encrypt data but at server file i am unable to decrypt data due to B_SharedKey i want to know that how can i access this B_SharedKey in server file from sensor file i try to send it to server file but output shows that i have to convert it into str and concatenate with other arguments but its not working as i passed it .... B_SharedKey type is point and how can i acess it as it is in server file from sensor file in pycharm

Zainab
  • 1
  • 2

1 Answers1

0

To answer exactly the question you've asked you could serialise or jsonify your Point object and reconstruct it at the server, however, this is not at all secure over an untrusted channel.

It looks like you are trying to roll your own crypto protocol with I strongly suggest you do not do. Instead use existing verified protocols/libraries to manage a secure connection.

Stanley
  • 321
  • 2
  • 6