Skip to content

Commit 85a9419

Browse files
authored
update dependecies (#94)
1 parent 0b08383 commit 85a9419

File tree

4 files changed

+1
-66
lines changed

4 files changed

+1
-66
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
configparser
2-
requests
32
toml
43
uuid

python/ppc_common/ppc_utils/utils.py

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from enum import Enum, unique
1212

1313
import jwt
14-
from ecdsa import SigningKey, SECP256k1, VerifyingKey
1514
from gmssl import func, sm2, sm3
1615
from google.protobuf.descriptor import FieldDescriptor
1716
from jsoncomment import JsonComment
@@ -326,57 +325,6 @@ def make_job_event_message(job_id, job_priority, initiator_agency_id, receiver_a
326325
return message.encode('utf-8')
327326

328327

329-
def sign_with_secp256k1(message, private_key_str):
330-
if isinstance(private_key_str, str):
331-
private_key = SigningKey.from_string(
332-
bytes().fromhex(private_key_str), curve=SECP256k1)
333-
else:
334-
private_key = SigningKey.from_string(private_key_str, curve=SECP256k1)
335-
signature_bytes = private_key.sign(
336-
make_hash(message, CryptoType.ECDSA, HashType.BYTES))
337-
return str(encode(signature_bytes), 'utf-8')
338-
339-
340-
def verify_with_secp256k1(message, signature_str, public_key_str):
341-
if isinstance(public_key_str, str):
342-
verify_key = VerifyingKey.from_string(
343-
bytes().fromhex(public_key_str), curve=SECP256k1)
344-
else:
345-
verify_key = VerifyingKey.from_string(
346-
decode(public_key_str), curve=SECP256k1)
347-
return verify_key.verify(decode(signature_str), make_hash(message, CryptoType.ECDSA, HashType.BYTES))
348-
349-
350-
def sign_with_sm2(message, private_key_str):
351-
sm2_crypt = sm2.CryptSM2(private_key_str, "")
352-
random_hex_str = func.random_hex(sm2_crypt.para_len)
353-
message_hash = make_hash(message, CryptoType.GM).encode(encoding='utf-8')
354-
signature_str = sm2_crypt.sign(message_hash, random_hex_str)
355-
return signature_str
356-
357-
358-
def verify_with_sm2(message, signature_str, public_key_str):
359-
sm2_crypt = sm2.CryptSM2("", public_key_str)
360-
message_hash = make_hash(message, CryptoType.GM).encode(encoding='utf-8')
361-
return sm2_crypt.verify(signature_str, message_hash)
362-
363-
364-
def make_signature(message, private_key_str, crypto_type):
365-
if crypto_type == CryptoType.ECDSA:
366-
return sign_with_secp256k1(message, private_key_str)
367-
368-
if crypto_type == CryptoType.GM:
369-
return sign_with_sm2(message, private_key_str)
370-
371-
372-
def verify_signature(message, signature, public_key_str, crypto_type):
373-
if crypto_type == CryptoType.ECDSA:
374-
return verify_with_secp256k1(message, signature, public_key_str)
375-
376-
if crypto_type == CryptoType.GM:
377-
return verify_with_sm2(message, signature, public_key_str)
378-
379-
380328
def exec_bash_command(cmd):
381329
"""replace commands.get_status_output
382330

python/requirements.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ pycryptodome==3.9.9
2727
pyjwt
2828
pyyaml
2929
mysqlclient==2.1.0
30-
waitress==2.1.2
30+
waitress==3.0.1
3131
sqlparse~=0.4.1
32-
ecdsa==0.19.0
3332
toolz~=0.11.1
3433
tenacity==7.0.0
3534
coincurve~=13.0.0
@@ -47,7 +46,6 @@ requests-toolbelt==0.9.1
4746
hdfs
4847
scikit-learn~=0.24.2
4948
gmpy2
50-
openpyxl
5149
networkx
5250
pydot
5351
snowland-smx

python/wedpr_ml_toolkit/wedpr_ml_toolkit/common/utils/utils.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import os
66
import random
77
from wedpr_ml_toolkit.common.utils.constant import Constant
8-
from urllib.parse import urlencode, urlparse, parse_qs, quote
98

109

1110
class IdPrefixEnum(Enum):
@@ -22,15 +21,6 @@ def generate_nonce(nonce_len):
2221
return ''.join(str(random.choice(Constant.NUMERIC_ARRAY)) for _ in range(nonce_len))
2322

2423

25-
def add_params_to_url(url, params):
26-
parsed_url = urlparse(url)
27-
query_params = parse_qs(parsed_url.query)
28-
for key, value in params.items():
29-
query_params[key] = value
30-
new_query = urlencode(query_params, doseq=True)
31-
return parsed_url._replace(query=new_query).geturl()
32-
33-
3424
def file_exists(_file):
3525
if os.path.exists(_file) and os.path.isfile(_file):
3626
return True

0 commit comments

Comments
 (0)