diff --git a/cpp/tools/ppc-builder/requirements.txt b/cpp/tools/ppc-builder/requirements.txt index aee2aa42..3d7ce2f7 100644 --- a/cpp/tools/ppc-builder/requirements.txt +++ b/cpp/tools/ppc-builder/requirements.txt @@ -1,4 +1,3 @@ configparser -requests toml uuid diff --git a/python/ppc_common/ppc_utils/utils.py b/python/ppc_common/ppc_utils/utils.py index 6450a4a4..5c38ee20 100644 --- a/python/ppc_common/ppc_utils/utils.py +++ b/python/ppc_common/ppc_utils/utils.py @@ -11,7 +11,6 @@ from enum import Enum, unique import jwt -from ecdsa import SigningKey, SECP256k1, VerifyingKey from gmssl import func, sm2, sm3 from google.protobuf.descriptor import FieldDescriptor from jsoncomment import JsonComment @@ -326,57 +325,6 @@ def make_job_event_message(job_id, job_priority, initiator_agency_id, receiver_a return message.encode('utf-8') -def sign_with_secp256k1(message, private_key_str): - if isinstance(private_key_str, str): - private_key = SigningKey.from_string( - bytes().fromhex(private_key_str), curve=SECP256k1) - else: - private_key = SigningKey.from_string(private_key_str, curve=SECP256k1) - signature_bytes = private_key.sign( - make_hash(message, CryptoType.ECDSA, HashType.BYTES)) - return str(encode(signature_bytes), 'utf-8') - - -def verify_with_secp256k1(message, signature_str, public_key_str): - if isinstance(public_key_str, str): - verify_key = VerifyingKey.from_string( - bytes().fromhex(public_key_str), curve=SECP256k1) - else: - verify_key = VerifyingKey.from_string( - decode(public_key_str), curve=SECP256k1) - return verify_key.verify(decode(signature_str), make_hash(message, CryptoType.ECDSA, HashType.BYTES)) - - -def sign_with_sm2(message, private_key_str): - sm2_crypt = sm2.CryptSM2(private_key_str, "") - random_hex_str = func.random_hex(sm2_crypt.para_len) - message_hash = make_hash(message, CryptoType.GM).encode(encoding='utf-8') - signature_str = sm2_crypt.sign(message_hash, random_hex_str) - return signature_str - - -def verify_with_sm2(message, signature_str, public_key_str): - sm2_crypt = sm2.CryptSM2("", public_key_str) - message_hash = make_hash(message, CryptoType.GM).encode(encoding='utf-8') - return sm2_crypt.verify(signature_str, message_hash) - - -def make_signature(message, private_key_str, crypto_type): - if crypto_type == CryptoType.ECDSA: - return sign_with_secp256k1(message, private_key_str) - - if crypto_type == CryptoType.GM: - return sign_with_sm2(message, private_key_str) - - -def verify_signature(message, signature, public_key_str, crypto_type): - if crypto_type == CryptoType.ECDSA: - return verify_with_secp256k1(message, signature, public_key_str) - - if crypto_type == CryptoType.GM: - return verify_with_sm2(message, signature, public_key_str) - - def exec_bash_command(cmd): """replace commands.get_status_output diff --git a/python/requirements.txt b/python/requirements.txt index c72f5f73..6fb0a6b7 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -27,9 +27,8 @@ pycryptodome==3.9.9 pyjwt pyyaml mysqlclient==2.1.0 -waitress==2.1.2 +waitress==3.0.1 sqlparse~=0.4.1 -ecdsa==0.19.0 toolz~=0.11.1 tenacity==7.0.0 coincurve~=13.0.0 @@ -47,7 +46,6 @@ requests-toolbelt==0.9.1 hdfs scikit-learn~=0.24.2 gmpy2 -openpyxl networkx pydot snowland-smx diff --git a/python/wedpr_ml_toolkit/wedpr_ml_toolkit/common/utils/utils.py b/python/wedpr_ml_toolkit/wedpr_ml_toolkit/common/utils/utils.py index 303c8dae..84556a46 100644 --- a/python/wedpr_ml_toolkit/wedpr_ml_toolkit/common/utils/utils.py +++ b/python/wedpr_ml_toolkit/wedpr_ml_toolkit/common/utils/utils.py @@ -5,7 +5,6 @@ import os import random from wedpr_ml_toolkit.common.utils.constant import Constant -from urllib.parse import urlencode, urlparse, parse_qs, quote class IdPrefixEnum(Enum): @@ -22,15 +21,6 @@ def generate_nonce(nonce_len): return ''.join(str(random.choice(Constant.NUMERIC_ARRAY)) for _ in range(nonce_len)) -def add_params_to_url(url, params): - parsed_url = urlparse(url) - query_params = parse_qs(parsed_url.query) - for key, value in params.items(): - query_params[key] = value - new_query = urlencode(query_params, doseq=True) - return parsed_url._replace(query=new_query).geturl() - - def file_exists(_file): if os.path.exists(_file) and os.path.isfile(_file): return True