GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat!:Support EC, Ed25519, RSA-PSS and post-quantum signing keys by kushaldas · Pull Request #352 · IdentityPython/pyFF

Conversation

@kushaldas

@kushaldas kushaldas commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

The sign pipe could only sign with RSA keys: it never passed a
signature method to pybergshamra, which then defaulted to rsa-sha256,
and the PKCS#11 path hardcoded RSA_SHA256. EC and Ed25519 keys failed
with "key type does not match algorithm".

The signature method is now chosen from the key type:

RSA rsa-sha256
EC P-256 ecdsa-sha256
EC P-384 ecdsa-sha384
EC P-521 ecdsa-sha512
Ed25519 eddsa-ed25519
ML-DSA-44/65/87 ml-dsa-* (W3C URI)
SLH-DSA-SHA2-* slh-dsa-sha2-* (W3C URI)

New optional sign pipe arguments:

signature_method short name (ecdsa-sha384, rsa-pss-sha256,
ml-dsa-65-xmlsec, ...) or a full algorithm URI;
must match the key type
digest_method sha256 (default), sha384, sha512, sha3-256,
sha3-384, sha3-512 or a URI
ec_curve P-256, P-384 or P-521, for ECDSA on a PKCS#11
token when no cert is configured

Invalid or mismatched values fail before any key is loaded or any
token login happens.

For PKCS#11 keys the key type and curve are read from the configured
cert. Without a cert or signature_method, rsa-sha256 is used as
before, so existing HSM configurations are unchanged. ML-DSA and
SLH-DSA are rejected on tokens since the pybergshamra PKCS#11 signer
does not support them.

certreport now applies size limits per key family: error_bits and
warning_bits (1024/2048) apply to RSA and DSA only, EC keys use the
new ec_error_bits (224) and ec_warning_bits (256), and EdDSA, ML-DSA
and SLH-DSA keys are not size checked. CertInfo gains key_family,
derived from the SubjectPublicKeyInfo OID, and keysize no longer
raises for key types cryptography cannot load (e.g. SLH-DSA), so
those certificates still get the expiry check.

The algorithm tables and selection logic live in the new module
pyff/sigalg.py. Tests cover sign and verify round trips for every key
type on both the document root and subtree paths, the overrides,
mocked PKCS#11 algorithm and curve selection, real signing on a
SoftHSM2 token with RSA, EC P-256 and Ed25519 keys (skipped when
SoftHSM2 or pkcs11-tool is missing), and certreport. ML-DSA-65 and
SLH-DSA-SHA2-128s test fixtures are copied from bergshamra
(BSD-2-Clause).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

vladimir-mencl-eresearch reacted with hooray emoji
All reactions
  • 🎉 1 reaction
kushaldas added 2 commits November 5, 2026 09:25
@kushaldas
feat!:Support EC, Ed25519, RSA-PSS and post-quantum signing keys
2dbbecc
The sign pipe could only sign with RSA keys: it never passed a
signature method to pybergshamra, which then defaulted to rsa-sha256,
and the PKCS#11 path hardcoded RSA_SHA256. EC and Ed25519 keys failed
with "key type does not match algorithm".

The signature method is now chosen from the key type:

  RSA              rsa-sha256
  EC P-256         ecdsa-sha256
  EC P-384         ecdsa-sha384
  EC P-521         ecdsa-sha512
  Ed25519          eddsa-ed25519
  ML-DSA-44/65/87  ml-dsa-* (W3C URI)
  SLH-DSA-SHA2-*   slh-dsa-sha2-* (W3C URI)

New optional sign pipe arguments:

  signature_method  short name (ecdsa-sha384, rsa-pss-sha256,
                    ml-dsa-65-xmlsec, ...) or a full algorithm URI;
                    must match the key type
  digest_method     sha256 (default), sha384, sha512, sha3-256,
                    sha3-384, sha3-512 or a URI
  ec_curve          P-256, P-384 or P-521, for ECDSA on a PKCS#11
                    token when no cert is configured

Invalid or mismatched values fail before any key is loaded or any
token login happens.

For PKCS#11 keys the key type and curve are read from the configured
cert. Without a cert or signature_method, rsa-sha256 is used as
before, so existing HSM configurations are unchanged. ML-DSA and
SLH-DSA are rejected on tokens since the pybergshamra PKCS#11 signer
does not support them.

certreport now applies size limits per key family: error_bits and
warning_bits (1024/2048) apply to RSA and DSA only, EC keys use the
new ec_error_bits (224) and ec_warning_bits (256), and EdDSA, ML-DSA
and SLH-DSA keys are not size checked. CertInfo gains key_family,
derived from the SubjectPublicKeyInfo OID, and keysize no longer
raises for key types cryptography cannot load (e.g. SLH-DSA), so
those certificates still get the expiry check.

The algorithm tables and selection logic live in the new module
pyff/sigalg.py. Tests cover sign and verify round trips for every key
type on both the document root and subtree paths, the overrides,
mocked PKCS#11 algorithm and curve selection, real signing on a
SoftHSM2 token with RSA, EC P-256 and Ed25519 keys (skipped when
SoftHSM2 or pkcs11-tool is missing), and certreport. ML-DSA-65 and
SLH-DSA-SHA2-128s test fixtures are copied from bergshamra
(BSD-2-Clause).
@kushaldas
add: CI runs softhsm tests
fae1007
@kushaldas
kushaldas force-pushed the feat/keys branch from 9b9225f to fae1007 Compare November 5, 2026 08:25
@kushaldas
reformat: ruff fixes
b2c74ba
@vladimir-mencl-eresearch

vladimir-mencl-eresearch commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Thanks! I'll give this a spin tomorrow and report back.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vladimir-mencl-eresearch

vladimir-mencl-eresearch commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Thanks @kushaldas !

Happy to confirm it works for me and signs valid metadata with an EC (P-384) key.

And performance for signing MDQ files across eduGAIN aggregate drops by a third (from 120s to 80s)

Thanks for getting this done!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@theseal theseal mentioned this pull request Nov 10, 2026
Crypto-Agility: support keys beyond RSA #349
Open
@restena-sw

restena-sw commented Nov 11, 2026

Copy link
Copy Markdown

I tested this with RSA/4096, ECDSA/p521, MLDSA-87 and SLHDSA/256s.

RSA, ML-DSA and SLH-DSA worked (wow!).

For some reason, ECDSA/p521 is still failing with the error I had previously:

ERROR:pyff.pipes:Got exception when loading/executing pipe: key error: unable to auto-detect key format from PEM data
kushaldas reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@restena-sw

restena-sw commented Nov 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Maybe my ECDSA private key omits some kind of needed attribute? I can paste the parts that aren't actually secret below.

PEM:

-----BEGIN EC PRIVATE KEY-----
...
-----END EC PRIVATE KEY-----

and

$ openssl ec -in eduID-ecdsa.key -noout -text
read EC key
Private-Key: (521 bit)
priv:
[...]
pub:
[...]
ASN1 OID: secp521r1
NIST CURVE: P-521
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kushaldas

kushaldas commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

For some reason, ECDSA/p521 is still failing with the error I had previously:

I will verify this one, thank you for testing this.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kushaldas

kushaldas commented Nov 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Maybe my ECDSA private key omits some kind of needed attribute? I can paste the parts that aren't actually secret below.

For now, can you please try once with PEM8 format key, openssl pkcs8 -topk8 -nocrypt -in p521.key -out p521-pkcs8.key ? It seems I did not add support for SEC1 type keys in the underlying libraries.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@kushaldas @vladimir-mencl-eresearch @restena-sw
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.