From caa3c035e7cad2dcff96e5d0f8ff3978c493de5a Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Wed, 17 Apr 2024 15:05:44 +0200 Subject: [PATCH] build(deps): drop curve25519-donna and ed25519 from deps [no changelog] --- crypto/tests/test_curves.py | 18 +++++++++--------- poetry.lock | 22 +--------------------- pyproject.toml | 2 -- 3 files changed, 10 insertions(+), 32 deletions(-) diff --git a/crypto/tests/test_curves.py b/crypto/tests/test_curves.py index 7bdbf928a..d0591f1d1 100755 --- a/crypto/tests/test_curves.py +++ b/crypto/tests/test_curves.py @@ -5,9 +5,9 @@ import hashlib import os import random -import curve25519 import ecdsa import pytest +from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey def bytes2num(s): @@ -344,17 +344,17 @@ def test_validate_pubkey_direct(point): def test_curve25519(r): sec1 = bytes(bytearray(r.randbytes(32))) sec2 = bytes(bytearray(r.randbytes(32))) - pub1 = curve25519.Private(sec1).get_public() - pub2 = curve25519.Private(sec2).get_public() + pub1 = X25519PrivateKey.from_private_bytes(sec1).public_key() + pub2 = X25519PrivateKey.from_private_bytes(sec2).public_key() session1 = r.randbytes(32) - lib.curve25519_scalarmult(session1, sec2, pub1.public) + lib.curve25519_scalarmult(session1, sec2, pub1.public_bytes_raw()) session2 = r.randbytes(32) - lib.curve25519_scalarmult(session2, sec1, pub2.public) + lib.curve25519_scalarmult(session2, sec1, pub2.public_bytes_raw()) assert bytearray(session1) == bytearray(session2) - shared1 = curve25519.Private(sec2).get_shared_key(pub1, hashfunc=lambda x: x) - shared2 = curve25519.Private(sec1).get_shared_key(pub2, hashfunc=lambda x: x) + shared1 = X25519PrivateKey.from_private_bytes(sec2).exchange(pub1) + shared2 = X25519PrivateKey.from_private_bytes(sec1).exchange(pub2) assert shared1 == shared2 assert bytearray(session1) == shared1 assert bytearray(session2) == shared2 @@ -362,10 +362,10 @@ def test_curve25519(r): def test_curve25519_pubkey(r): sec = bytes(bytearray(r.randbytes(32))) - pub = curve25519.Private(sec).get_public() + pub = X25519PrivateKey.from_private_bytes(sec).public_key() res = r.randbytes(32) lib.curve25519_scalarmult_basepoint(res, sec) - assert bytearray(res) == pub.public + assert bytearray(res) == pub.public_bytes_raw() def test_curve25519_scalarmult_from_gpg(r): diff --git a/poetry.lock b/poetry.lock index 7c3fc66a5..8939c666a 100644 --- a/poetry.lock +++ b/poetry.lock @@ -370,16 +370,6 @@ ssh = ["bcrypt (>=3.1.5)"] test = ["certifi", "pretend", "pytest (>=6.2.0)", "pytest-benchmark", "pytest-cov", "pytest-xdist"] test-randomorder = ["pytest-randomly"] -[[package]] -name = "curve25519-donna" -version = "1.3" -description = "Python wrapper for the Curve25519 cryptographic library" -optional = false -python-versions = "*" -files = [ - {file = "curve25519-donna-1.3.tar.gz", hash = "sha256:1818a9d5356a05c022cd504f44fe1d2f641a5c020f8a4c51b2294e02bd9c1bf0"}, -] - [[package]] name = "demjson3" version = "3.0.5" @@ -445,16 +435,6 @@ six = ">=1.9.0" gmpy = ["gmpy"] gmpy2 = ["gmpy2"] -[[package]] -name = "ed25519" -version = "1.5" -description = "Ed25519 public-key signatures" -optional = false -python-versions = "*" -files = [ - {file = "ed25519-1.5.tar.gz", hash = "sha256:02053ee019ceef0df97294be2d4d5a8fc120fc86e81e08bec1245fc0f9403358"}, -] - [[package]] name = "execnet" version = "1.9.0" @@ -1824,4 +1804,4 @@ testing = ["func-timeout", "jaraco.itertools", "pytest (>=6)", "pytest-black (>= [metadata] lock-version = "2.0" python-versions = "^3.8.1" -content-hash = "aee23e80ff37c84f73fad88ed177b3459cafb34202e6d1ecf8bf99446d43a401" +content-hash = "c1a5ee4dda4cbbfd897232da06ce54e8e9047669d23f825ade8fc395f68a10cd" diff --git a/pyproject.toml b/pyproject.toml index f60933bd3..642215eea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,14 +50,12 @@ graphviz = "*" ## cointool click = "^8" -ed25519 = "^1.4" requests = "^2.31" termcolor = "*" Pillow = ">=10.0.1" # crypto ecdsa = "^0.16" -curve25519-donna = "*" pyasn1 = "*" # legacy