Skip to content

Add signature AlgorithmIdentifier support - #670

Merged
mtrojnar merged 1 commit into
OpenSC:masterfrom
olszomal:algorithm-id
Aug 7, 2026
Merged

Add signature AlgorithmIdentifier support#670
mtrojnar merged 1 commit into
OpenSC:masterfrom
olszomal:algorithm-id

Conversation

@olszomal

@olszomal olszomal commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Pull Request Type

  • Bug fix
  • New feature
  • Code style / formatting / renaming
  • Refactoring (no functional or API changes)
  • Build / CI related changes
  • Documentation
  • Other (please describe):

Related Issue

Issue number: N/A

Current Behavior

Generating a certificate with a PKCS#11 private key fails during AlgorithmIdentifier processing with ASN.1 errors:

asn1_item_embed_d2i:too small
ASN1_item_sign_ctx:internal error

and eventually causes a segmentation fault.

New Behavior

Generating self-signed certificates and CSRs with PKCS#11-backed signing keys succeeds without ASN.1 errors or crashes, with a valid signature AlgorithmIdentifier returned by the provider.

Scope of Changes

Add OSSL_SIGNATURE_PARAM_ALGORITHM_ID support to the PKCS#11 provider.

This includes:

  • DER-encoded signature AlgorithmIdentifiers
  • RSA-PSS parameters with digest, MGF1 digest and salt length
  • OpenSSL-compatible RSA-PSS default salt length
  • fixed string PSS salt length parsing
  • separate gettable and settable signature parameters

This fixes certificate and CSR generation with provider-backed signing keys.

Testing

  • Existing tests
  • New tests added
  • Manual testing

Additional Notes

License Declaration

  • I hereby agree to license my contribution under the project's license.

Add DER-encoded AlgorithmIdentifier support, including RSA-PSS
parameters and correct default salt length handling. Also fix PSS
salt length parsing and separate gettable/settable signature parameters.
@mtrojnar
mtrojnar merged commit c0f12ff into OpenSC:master Aug 7, 2026
11 checks passed
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.

2 participants