Skip to content

Commit

Permalink
update modules and fix problems
Browse files Browse the repository at this point in the history
  • Loading branch information
quvox committed May 1, 2021
1 parent a271d4d commit e783219
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 18 deletions.
3 changes: 1 addition & 2 deletions bbc1/core/bbc_config.py
Expand Up @@ -17,8 +17,7 @@
import os
import json
import copy
from threading import RLock
from collections import Mapping
from collections.abc import Mapping

import sys
sys.path.extend(["../../"])
Expand Down
2 changes: 1 addition & 1 deletion bbc1/core/bbc_core.py
Expand Up @@ -178,7 +178,7 @@ def __init__(self, p2p_port=None, core_port=None, use_domain0=False, ip4addr=Non
else:
self.logger.info("Failed to load ledger_subsystem module")

gevent.signal(signal.SIGINT, self.quit_program)
gevent.signal_handler(signal.SIGINT, self.quit_program)
if server_start:
self._start_server(core_port)

Expand Down
7 changes: 3 additions & 4 deletions bbc1/core/message_key_types.py
Expand Up @@ -19,7 +19,7 @@
import msgpack
import struct
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives import _serialization, hashes
from cryptography.hazmat.primitives.asymmetric import ec
from cryptography.hazmat.primitives.kdf.hkdf import HKDF
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
Expand Down Expand Up @@ -158,7 +158,7 @@ def get_ECDH_parameters():
"""Utility for initialization of ECDH parameters"""
global encryptors, decryptors
private_key = ec.generate_private_key(ec.SECP384R1(), default_backend())
serialized_pubkey = private_key.public_key().public_numbers().encode_point()
serialized_pubkey = private_key.public_key().public_bytes(_serialization.Encoding.X962, _serialization.PublicFormat.UncompressedPoint)
key_name = None
while key_name is None:
key_name = os.urandom(4)
Expand All @@ -171,8 +171,7 @@ def get_ECDH_parameters():

def derive_shared_key(private_key, serialized_pubkey, shared_info):
"""Utility for deriving shared key in ECDH procedure"""
deserialized_public_numbers = ec.EllipticCurvePublicNumbers.from_encoded_point(ec.SECP384R1(), serialized_pubkey)
deserialized_pubkey = deserialized_public_numbers.public_key(default_backend())
deserialized_pubkey = ec.EllipticCurvePublicKey.from_encoded_point(ec.SECP384R1(), serialized_pubkey)
shared_key = private_key.exchange(ec.ECDH(), deserialized_pubkey)
derived_key = HKDF(algorithm=hashes.SHA256(), length=32, salt=None,
info=shared_info, backend=default_backend()).derive(shared_key)
Expand Down
39 changes: 29 additions & 10 deletions requirements.txt
@@ -1,11 +1,30 @@
pyOpenSSL==19.1.0
jinja2==2.11.2
requests==2.23.0
gevent==1.4.0
greenlet
cryptography==2.9.2
pytest==5.4.2
py-bbclib==1.6
attrs==20.3.0
bson==0.5.10
certifi==2020.12.5
cffi==1.14.5
chardet==4.0.0
cryptography==3.4.7
gevent==21.1.2
greenlet==1.0.0
idna==2.10
iniconfig==1.1.1
Jinja2==2.11.3
MarkupSafe==1.1.1
msgpack-python==0.5.6
mysql-connector-python==8.0.20
bson
mysql-connector-python==8.0.24
packaging==20.9
pluggy==0.13.1
protobuf==3.15.8
py==1.10.0
py-bbclib==1.6.1
pycparser==2.20
pyOpenSSL==20.0.1
pyparsing==2.4.7
pytest==6.2.3
python-dateutil==2.8.1
requests==2.25.1
six==1.15.0
toml==0.10.2
urllib3==1.26.4
zope.event==4.5.0
zope.interface==5.4.0
3 changes: 2 additions & 1 deletion tests/pytest.ini
@@ -1,4 +1,5 @@
[pytest]
addopts = --capture=no
markers =
register: exec register/unregister
register: exec register
unregister: exec unregister

0 comments on commit e783219

Please sign in to comment.