Skip to content

SunPKCS11 CKR_ARGUMENTS_BAD fixes #11 - #12

Merged
Le-Syl21 merged 3 commits into
Le-Syl21:mainfrom
EugenMayer:fix/issue-11
Sep 16, 2026
Merged

Le-Syl21 merged 3 commits into
Le-Syl21:mainfrom
EugenMayer:fix/issue-11

Conversation

@EugenMayer

@EugenMayer EugenMayer commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #11

Le-Syl21 and others added 2 commits September 16, 2026 20:40
CKM_SHA256_RSA_PKCS hands the token the message, not a digest, and the token
hashes it. The module expected a bare 32-byte digest, so every conforming
caller (jsign through Java SunPKCS11, pkcs11-tool) got CKR_ARGUMENTS_BAD.

Always hash under that mechanism instead of guessing from the length: a
32-byte or DigestInfo-shaped message would otherwise be signed unhashed.
CKM_RSA_PKCS (osslsigncode) is unchanged and still refuses anything but a
SHA-256 DigestInfo or digest, rather than signing a re-hashed SHA-384 one.
The debug print is dropped; unit tests cover both mechanisms.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ENsGGxgZ7pU5Z87YfBS2iY
A new pre-sign-checks job, after the build and behind the signing
environment, drives the Certum cloud with the Linux binaries of the run:
CKM_SHA256_RSA_PKCS (multi-part, 32- and 51-byte messages included) against
CKM_RSA_PKCS with pkcs11-tool, jsign through SunPKCS11 on PE and MSI,
osslsigncode on every format, and the CLI. Both signing jobs, and so the
release, need it. It also runs on workflow_dispatch.

The build job gains a credential-free smoke test of the module: it loads,
shows the ssign token and the SHA-256 RSA mechanisms.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ENsGGxgZ7pU5Z87YfBS2iY
@Le-Syl21
Le-Syl21 merged commit c934696 into Le-Syl21:main Sep 16, 2026
10 checks passed
@EugenMayer

Copy link
Copy Markdown
Contributor Author

Nice to add tests, i should have done that. Thank you!

@Le-Syl21

Copy link
Copy Markdown
Owner

Thanks for the report and the fix! One change on top: under CKM_SHA256_RSA_PKCS the module now always hashes instead of guessing from the length, since a 32-byte message would have been signed unhashed. jsign on EXE and MSI is now checked before every release. The fix ships in 0.1.6.

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.

ssign-pkcs11 fails under Java SunPKCS11: CKR_ARGUMENTS_BAD from C_SignFinal (works with osslsigncode)

2 participants