Skip to content

PublicKey.used_explicit_encoding() in python wrapper#5282

Merged
reneme merged 1 commit intorandombit:masterfrom
Rohde-Schwarz:feature/pubkey_expl_enc
Feb 4, 2026
Merged

PublicKey.used_explicit_encoding() in python wrapper#5282
reneme merged 1 commit intorandombit:masterfrom
Rohde-Schwarz:feature/pubkey_expl_enc

Conversation

@reneme
Copy link
Collaborator

@reneme reneme commented Feb 3, 2026

This API is meaningful only for ECC keys and returns true if the loaded public key contained an explicitly defined ECC group.

This API is meaningful only for ECC keys and returns true if the loaded
public key contained an explicitly defined ECC group.
@reneme reneme self-assigned this Feb 3, 2026
Copilot AI review requested due to automatic review settings February 3, 2026 16:09
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the Python Botan 3 wrapper with an API to detect whether an ECC public key uses an explicitly encoded group and adds tests around that behavior.

Changes:

  • Adds a new FFI binding for botan_pubkey_ecc_key_used_explicit_encoding in botan3.py.
  • Exposes this via PublicKey.used_explicit_encoding() in the Python wrapper, raising a BotanException for non‑ECC keys.
  • Extends test_rsa_load_store and test_ecdh to verify the behavior for RSA keys, ECC keys with explicit groups, and standard named ECC groups.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/python/botan3.py Binds the new FFI function and introduces PublicKey.used_explicit_encoding() with appropriate error handling for non‑ECC keys.
src/scripts/test_python.py Adds unit tests covering used_explicit_encoding() for RSA keys (exception), an explicitly-parameterized ECC public key, and normal named ECDH groups (returns False).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@reneme reneme changed the title PublicKey.uses_explicit_encoding() in python wrapper PublicKey.used_explicit_encoding() in python wrapper Feb 3, 2026
@coveralls
Copy link

Coverage Status

coverage: 90.076% (+0.005%) from 90.071%
when pulling cc86ce8 on Rohde-Schwarz:feature/pubkey_expl_enc
into d951175 on randombit:master.

@reneme reneme merged commit 413f230 into randombit:master Feb 4, 2026
52 checks passed
@reneme reneme deleted the feature/pubkey_expl_enc branch February 4, 2026 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants