From a0ae8897d748fbc15afe55d2644c91b6a321088d Mon Sep 17 00:00:00 2001 From: Zola Gonano Date: Fri, 24 Dec 2021 15:15:11 +0000 Subject: [PATCH] Replace CryptRsa with CryptTor --- src/Test/TestTor.py | 12 ++++++------ src/Tor/TorManager.py | 8 +++++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Test/TestTor.py b/src/Test/TestTor.py index 0252d73a..e6b82c1a 100644 --- a/src/Test/TestTor.py +++ b/src/Test/TestTor.py @@ -4,7 +4,7 @@ import pytest import mock from File import FileServer -from Crypt import CryptRsa +from Crypt import CryptTor from Config import config @pytest.mark.usefixtures("resetSettings") @@ -34,17 +34,17 @@ class TestTor: address = tor_manager.addOnion() # Sign - sign = CryptRsa.sign(b"hello", tor_manager.getPrivatekey(address)) + sign = CryptTor.sign(b"hello", tor_manager.getPrivatekey(address)) assert len(sign) == 128 # Verify - publickey = CryptRsa.privatekeyToPublickey(tor_manager.getPrivatekey(address)) + publickey = CryptTor.privatekeyToPublickey(tor_manager.getPrivatekey(address)) assert len(publickey) == 140 - assert CryptRsa.verify(b"hello", publickey, sign) - assert not CryptRsa.verify(b"not hello", publickey, sign) + assert CryptTor.verify(b"hello", publickey, sign) + assert not CryptTor.verify(b"not hello", publickey, sign) # Pub to address - assert CryptRsa.publickeyToOnion(publickey) == address + assert CryptTor.publickeyToOnion(publickey) == address # Delete tor_manager.delOnion(address) diff --git a/src/Tor/TorManager.py b/src/Tor/TorManager.py index c0b99759..865d8fbf 100644 --- a/src/Tor/TorManager.py +++ b/src/Tor/TorManager.py @@ -12,8 +12,10 @@ import atexit import gevent from Config import config -from Crypt import CryptEd25519 -from Crypt import CryptRsa + +from lib import Ed25519 +from Crypt import CryptTor + from Site import SiteManager import socks from gevent.lock import RLock @@ -272,7 +274,7 @@ class TorManager(object): return self.privatekeys[address] def getPublickey(self, address): - return CryptRsa.privatekeyToPublickey(self.privatekeys[address]) + return CryptTor.privatekeyToPublickey(self.privatekeys[address]) def getOnion(self, site_address): if not self.enabled: