Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions python/http_ece/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def length_prefix(key):
if dh is not None:
if private_key is None:
raise ECEException("DH requires a private_key")
(secret, context) = derive_dh(
secret, context = derive_dh(
mode=mode,
version=version,
private_key=private_key,
Expand Down Expand Up @@ -273,7 +273,7 @@ def unpad(data, last):
content = content_header["content"]
overhead += 16

(key_, nonce_) = derive_key(
key_, nonce_ = derive_key(
"decrypt",
version=version,
salt=salt,
Expand Down Expand Up @@ -391,7 +391,7 @@ def compose_aes128gcm(salt, content, rs, keyid):
if salt is None:
salt = os.urandom(16)

(key_, nonce_) = derive_key(
key_, nonce_ = derive_key(
"encrypt",
version=version,
salt=salt,
Expand Down
12 changes: 7 additions & 5 deletions python/http_ece/tests/test_ece.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,8 @@ def _run(self, mode):
inp = "encrypted"
outp = "input"

for data in self.legacy_data:
logmsg("{}: {}".format(mode, data["test"]))
for version, data in self.legacy_data.items():
logmsg("{}: {}".format(mode, data.get("test")))
p = data["params"][mode]

if "pad" in p and mode == "encrypt":
Expand All @@ -438,8 +438,10 @@ def _run(self, mode):

if "keys" in data:
key = None
decode_pub = ec.EllipticCurvePublicNumbers.from_encoded_point
pubnum = decode_pub(ec.SECP256R1(), b64d(data["keys"][local]["public"]))
decode_pub = ec.EllipticCurvePublicKey.from_encoded_point
pubnum = decode_pub(
ec.SECP256R1(), b64d(data["keys"][local]["public"])
).public_numbers()
d = 0
dbin = b64d(data["keys"][local]["private"])
for i in range(0, len(dbin), 4):
Expand Down Expand Up @@ -468,7 +470,7 @@ def _run(self, mode):
keyid=p.get("keyid"),
private_key=private_key,
rs=p.get("rs", 4096),
version=p["version"],
version=p.get("version") or version,
)
assert b64d(data[outp]) == result

Expand Down
32 changes: 8 additions & 24 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ build-backend = "setuptools.build_meta"
name = "http_ece"
version = "1.2.1"
license = "MIT"
authors = [
{ name = "Martin Thomson", email = "martin.thomson@gmail.com" }
]
authors = [{ name = "Martin Thomson", email = "martin.thomson@gmail.com" }]
keywords = ["crypto http"]
classifiers = [
"Development Status :: 4 - Beta",
Expand All @@ -21,13 +19,11 @@ classifiers = [
description = "Encrypted Content Encoding for HTTP"
readme = { file = "README.rst", content-type = "text/x-rst" }
requires-python = ">=3.10"
dependencies = [
"cryptography>=45.0.1"
]
dependencies = ["cryptography>=46.0.1"]

[project.optional-dependencies]
dev = [
"black==25.12.0",
"black>=26.3.1",
"pytest",
"pytest-cov",
"ruff==0.14.10",
Expand All @@ -50,21 +46,9 @@ log_format = "%(asctime)s,%(msecs)03d %(name)s: %(levelname)s: %(message)s"
log_file_date_format = "%H:%M:%S"

[tool.ruff]
lint.select = [
"A",
"F",
"FURB",
"I",
"PERF",
"PT",
"PTH",
"RUF",
"S",
"UP",
]
lint.select = ["A", "F", "FURB", "I", "PERF", "PT", "PTH", "RUF", "S", "UP"]
[tool.ruff.lint.extend-per-file-ignores]
"**/tests/**" = [
"A001",
"A002",
"S101",
]
"**/tests/**" = ["A001", "A002", "S101"]

[tool.setuptools]
packages = ["http_ece"]
Loading