mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-16 02:40:14 +00:00
Work on tunnels
This commit is contained in:
parent
ce00822cb0
commit
7d804daa8f
@ -945,9 +945,10 @@ class Transport:
|
|||||||
expected_length = RNS.Identity.KEYSIZE//8+RNS.Identity.HASHLENGTH//8+RNS.Reticulum.TRUNCATED_HASHLENGTH//8+RNS.Identity.SIGLENGTH//8
|
expected_length = RNS.Identity.KEYSIZE//8+RNS.Identity.HASHLENGTH//8+RNS.Reticulum.TRUNCATED_HASHLENGTH//8+RNS.Identity.SIGLENGTH//8
|
||||||
|
|
||||||
if len(data) == expected_length:
|
if len(data) == expected_length:
|
||||||
tunnel_id = RNS.Identity.full_hash(data[:RNS.Identity.KEYSIZE//8+RNS.Identity.HASHLENGTH])
|
public_key = data[:RNS.Identity.KEYSIZE//8]
|
||||||
public_key = data[:RNS.Identity.KEYSIZE//8]
|
tunnel_id = RNS.Identity.full_hash(data[:RNS.Identity.KEYSIZE//8+RNS.Identity.HASHLENGTH])
|
||||||
signature = data[RNS.Identity.KEYSIZE//8+RNS.Identity.HASHLENGTH//8+RNS.Reticulum.TRUNCATED_HASHLENGTH//8:expected_length]
|
random_hash = data[RNS.Identity.KEYSIZE//8+RNS.Identity.HASHLENGTH:RNS.Identity.KEYSIZE//8+RNS.Identity.HASHLENGTH//8+RNS.Reticulum.TRUNCATED_HASHLENGTH//8]
|
||||||
|
signature = data[RNS.Identity.KEYSIZE//8+RNS.Identity.HASHLENGTH//8+RNS.Reticulum.TRUNCATED_HASHLENGTH//8:expected_length]
|
||||||
|
|
||||||
remote_transport_identity = RNS.Identity(create_keys=False)
|
remote_transport_identity = RNS.Identity(create_keys=False)
|
||||||
remote_transport_identity.load_public_key(public_key)
|
remote_transport_identity.load_public_key(public_key)
|
||||||
@ -957,7 +958,7 @@ class Transport:
|
|||||||
RNS.log("Public key : "+RNS.hexrep(public_key))
|
RNS.log("Public key : "+RNS.hexrep(public_key))
|
||||||
RNS.log("Signature : "+RNS.hexrep(signature))
|
RNS.log("Signature : "+RNS.hexrep(signature))
|
||||||
|
|
||||||
if remote_transport_identity.validate(signature):
|
if remote_transport_identity.validate(signature, signed_data):
|
||||||
RNS.log("Signature is valid")
|
RNS.log("Signature is valid")
|
||||||
else:
|
else:
|
||||||
RNS.log("Signature is invalid")
|
RNS.log("Signature is invalid")
|
||||||
|
Loading…
Reference in New Issue
Block a user