commit ae46b18eadf02d8d89e2f393c387deea119d47e6 Author: Damian Johnson atagar@torproject.org Date: Tue Oct 1 14:59:23 2019 -0700
Drop debug print statments
Time to drop the debugging statements asn included while developing this. --- stem/descriptor/hidden_service.py | 2 +- stem/descriptor/hsv3_crypto.py | 31 ------------------------------- 2 files changed, 1 insertion(+), 32 deletions(-)
diff --git a/stem/descriptor/hidden_service.py b/stem/descriptor/hidden_service.py index 802ca6c4..33806ce5 100644 --- a/stem/descriptor/hidden_service.py +++ b/stem/descriptor/hidden_service.py @@ -582,7 +582,7 @@ class HiddenServiceDescriptorV3(BaseHiddenServiceDescriptor):
inner_layer_plaintext = stem.descriptor.hsv3_crypto.decrypt_inner_layer(inner_layer_ciphertext, self.revision_counter, identity_public_key_bytes, blinded_key_bytes, subcredential_bytes)
- print(inner_layer_plaintext) + return inner_layer_plaintext
# TODO: drop this alias in stem 2.x diff --git a/stem/descriptor/hsv3_crypto.py b/stem/descriptor/hsv3_crypto.py index 248eacec..f768659f 100644 --- a/stem/descriptor/hsv3_crypto.py +++ b/stem/descriptor/hsv3_crypto.py @@ -110,13 +110,6 @@ def get_subcredential(public_identity_key, blinded_key): credential = hashlib.sha3_256(b'%s%s' % (cred_bytes_constant, public_identity_key)).digest() subcredential = hashlib.sha3_256(b'%s%s%s' % (subcred_bytes_constant, credential, blinded_key)).digest()
- print('public_identity_key: %s' % (binascii.hexlify(public_identity_key))) - print('credential: %s' % (binascii.hexlify(credential))) - print('blinded_key: %s' % (binascii.hexlify(blinded_key))) - print('subcredential: %s' % (binascii.hexlify(subcredential))) - - print('===') - return subcredential
@@ -173,10 +166,6 @@ def _ciphertext_mac_is_valid(key, salt, ciphertext, mac): my_mac_body = b'%s%s%s%s%s' % (key_len, key, salt_len, salt, ciphertext) my_mac = hashlib.sha3_256(my_mac_body).digest()
- print('===') - print('my mac: %s' % binascii.hexlify(my_mac)) - print('their mac: %s' % binascii.hexlify(mac)) - # Compare the two MACs return my_mac == mac
@@ -198,23 +187,11 @@ def _decrypt_descriptor_layer(ciphertext_blob_b64, revision_counter, public_iden ciphertext = ciphertext_blob[16:-32] mac = ciphertext_blob[-32:]
- print('encrypted blob lenth :%s' % len(ciphertext_blob)) - print('salt: %s' % binascii.hexlify(salt)) - print('ciphertext length: %s' % len(ciphertext)) - print('mac: %s' % binascii.hexlify(mac)) - print('===') - # INT_8(revision_counter) rev_counter_int_8 = struct.pack('>Q', revision_counter) secret_input = b'%s%s%s' % (secret_data, subcredential, rev_counter_int_8) secret_input = secret_input
- print('secret_data (%d): %s' % (len(secret_data), binascii.hexlify(secret_data))) - print('subcredential (%d): %s' % (len(subcredential), binascii.hexlify(subcredential))) - print('rev counter int 8 (%d): %s' % (len(rev_counter_int_8), binascii.hexlify(rev_counter_int_8))) - print('secret_input (%s): %s' % (len(secret_input), binascii.hexlify(secret_input))) - print('===') - kdf = hashlib.shake_256(b'%s%s%s' % (secret_input, salt, string_constant)) keys = kdf.digest(S_KEY_LEN + S_IV_LEN + MAC_KEY_LEN)
@@ -222,10 +199,6 @@ def _decrypt_descriptor_layer(ciphertext_blob_b64, revision_counter, public_iden secret_iv = keys[S_KEY_LEN:S_KEY_LEN + S_IV_LEN] mac_key = keys[S_KEY_LEN + S_IV_LEN:]
- print('secret_key: %s' % binascii.hexlify(secret_key)) - print('secret_iv: %s' % binascii.hexlify(secret_iv)) - print('mac_key: %s' % binascii.hexlify(mac_key)) - # Now time to decrypt descriptor cipher = Cipher(algorithms.AES(secret_key), modes.CTR(secret_iv), default_backend()) decryptor = cipher.decryptor() @@ -246,8 +219,6 @@ def decrypt_outter_layer(superencrypted_blob_b64, revision_counter, public_ident superencrypted_blob_b64_lines = superencrypted_blob_b64.split('\n') superencrypted_blob_b64 = ''.join(superencrypted_blob_b64_lines[1:-1])
- print('====== Decrypting outter layer =======') - return _decrypt_descriptor_layer(superencrypted_blob_b64, revision_counter, public_identity_key, subcredential, secret_data, string_constant)
@@ -255,8 +226,6 @@ def decrypt_inner_layer(encrypted_blob_b64, revision_counter, public_identity_ke secret_data = blinded_key string_constant = b'hsdir-encrypted-data'
- print('====== Decrypting inner layer =======') - return _decrypt_descriptor_layer(encrypted_blob_b64, revision_counter, public_identity_key, subcredential, secret_data, string_constant)