You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by sb...@apache.org on 2026/04/28 13:28:04 UTC

(tooling-trusted-releases) branch sbp updated: Restore support for DSA keys

This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch sbp
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git


The following commit(s) were added to refs/heads/sbp by this push:
     new 9cc1dbbe Restore support for DSA keys
9cc1dbbe is described below

commit 9cc1dbbe44aeff0677c3a78214175343cfc854b3
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Tue Apr 28 14:27:31 2026 +0100

    Restore support for DSA keys
---
 atr/storage/writers/keys.py    |  7 ++++++-
 tests/unit/test_keys_writer.py | 11 +++++++++++
 uv.lock                        |  2 +-
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/atr/storage/writers/keys.py b/atr/storage/writers/keys.py
index b08c962f..54c8e259 100644
--- a/atr/storage/writers/keys.py
+++ b/atr/storage/writers/keys.py
@@ -133,12 +133,15 @@ def _key_length(key: openpgp.PublicKey) -> int:
     rsa_bits = public_params.rsa_bits
     if isinstance(rsa_bits, int):
         return rsa_bits
+    dsa_bits = public_params.dsa_bits
+    if isinstance(dsa_bits, int):
+        return dsa_bits
     curve_bits = public_params.curve_bits
     if isinstance(curve_bits, int):
         return curve_bits
     raise ValueError(
         f"Key size is not available for algorithm {key.public_key_algorithm}:"
-        f" rsa_bits={rsa_bits!r}, curve_bits={curve_bits!r}"
+        f" rsa_bits={rsa_bits!r}, dsa_bits={dsa_bits!r}, curve_bits={curve_bits!r}"
     )
 
 
@@ -237,6 +240,8 @@ class FoundationCommitter(GeneralPublic):
     ) -> sql.PublicSigningKey:
         uids = list(key.user_ids)
         asf_uid = self.__uids_asf_uid(uids, ldap_data)
+        if not uids:
+            raise ValueError("No UIDs found in key")
 
         # Use the original key block if available
         ascii_armored = original_key_block if original_key_block else key.to_armored()
diff --git a/tests/unit/test_keys_writer.py b/tests/unit/test_keys_writer.py
index d82c4418..16f54522 100644
--- a/tests/unit/test_keys_writer.py
+++ b/tests/unit/test_keys_writer.py
@@ -231,6 +231,17 @@ def test_key_expires_at_uses_v4_user_binding_expiration() -> None:
     )
 
 
+def test_key_length_returns_dsa_bits() -> None:
+    key = SimpleNamespace(
+        public_key_algorithm="dsa",
+        public_params=SimpleNamespace(rsa_bits=None, dsa_bits=3072, curve_bits=None),
+    )
+
+    length = keys_writer._key_length(key)
+
+    assert length == 3072
+
+
 def test_public_key_model_stores_latest_self_signature_separately_from_expiry() -> None:
     key, _ = keys_writer.openpgp.PublicKey.from_armor(_EMBEDDED_V4_EXPIRING_KEY_ASC)
     binding = next(iter(key.user_bindings()))
diff --git a/uv.lock b/uv.lock
index 5cbc94e3..81b4e1a9 100644
--- a/uv.lock
+++ b/uv.lock
@@ -3,7 +3,7 @@ revision = 3
 requires-python = "==3.13.*"
 
 [options]
-exclude-newer = "2026-04-28T13:07:00Z"
+exclude-newer = "2026-04-28T13:14:30Z"
 
 [[package]]
 name = "aiofiles"


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org