[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Populate fingerprints for created server descriptors
commit 02eb36058f91f88952378df76bc8584fa8a95ee0
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Fri Jun 30 10:25:57 2017 -0700
Populate fingerprints for created server descriptors
Not technically a mandatory field but lets be honest, if you provide a signing
key you want this. ;P
---
stem/descriptor/server_descriptor.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/stem/descriptor/server_descriptor.py b/stem/descriptor/server_descriptor.py
index 42cbca6..643831b 100644
--- a/stem/descriptor/server_descriptor.py
+++ b/stem/descriptor/server_descriptor.py
@@ -826,6 +826,10 @@ class RelayDescriptor(ServerDescriptor):
if signing_key is None:
signing_key = create_signing_key()
+ if 'fingerprint' not in attr:
+ fingerprint = hashlib.sha1(_bytes_for_block(signing_key.public_digest.strip())).hexdigest().upper()
+ attr['fingerprint'] = ' '.join(stem.util.str_tools._split_by_length(fingerprint, 4))
+
attr['signing-key'] = signing_key.public_digest
content = _descriptor_content(attr, exclude, sign, base_header) + b'\nrouter-signature\n'
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits