Skip to content

Reject unsupported multi-prime RSA JWKs - #190

Merged
TheStormN merged 1 commit into
masterfrom
reject-rsa-oth-fix
Sep 12, 2026
Merged

TheStormN merged 1 commit into
masterfrom
reject-rsa-oth-fix

Conversation

@TheStormN

Copy link
Copy Markdown
Contributor

Summary

cjose supports only two-prime RSA keys. RFC 7518 section 6.3.2.7 defines the oth parameter for RSA keys with three or more prime factors and requires consumers that do not support multi-prime keys not to use such keys.

Previously, RSA JWK import ignored oth and could silently interpret an unsupported key as a two-prime RSA key.

This change rejects any RSA JWK containing oth with CJOSE_ERR_INVALID_ARG before importing the key material.

Testing

  • Added regression coverage for a populated oth array.
  • Added coverage for a null oth value.

@TheStormN
TheStormN merged commit 1891c2b into master Sep 12, 2026
27 checks passed
@TheStormN
TheStormN deleted the reject-rsa-oth-fix branch September 12, 2026 23:43
TheStormN pushed a commit that referenced this pull request Sep 15, 2026
The 1.0.0 section carried only the Breaking list that #187 wrote, so nothing
merged after it was recorded: the A*GCMKW, PBES2, X25519/X448 and ML-DSA
algorithms, the "crit" refusal and the JWE header disjointness, the JWK import
refusals of #189, #190, #192 and #193, the NULL cjose_err crash of #191 and the
EVP_Q_mac change of #196. The entries reference pull requests, as the rest of
that section does, rather than the commit links the released sections use.

The "crit" refusal is listed as breaking because it refuses a JWE or JWS that
0.8.0 accepted. Three more rules do the same without changing the API, so they
stay under Fix and a Compatibility paragraph names them, the way the 0.8.1
notes do: the disjointness of the header locations, the refusal of a header
parameter the algorithm generates, and the refusal of a valueless private
member in an RSA or EC key.

0.8.1 was released from the 0.8.x branch on 2026-09-14 and its section only
ever existed there, so this file jumped from the unreleased 1.0.0 straight to
0.8.0 and the release was invisible here. It is copied over unchanged.

The README already describes the ML-DSA algorithms, the AKP key type and the
CJOSE_ENABLE_ML_DSA option; the only thing missing was the OpenSSL requirement
in the prerequisites, which named 3.0.0 alone.

Signed-off-by: Hans Zandbelt <hans.zandbelt@openidc.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
TheStormN pushed a commit that referenced this pull request Sep 15, 2026
Three sentences #199 added describe the 0.8.x line or an earlier commit
rather than what main does, found by a review of the merged text against
the source at 0.8.0 and at each pull request.

The generated-parameter entry said the check for a caller-supplied "epk" had
read it as a string and so never saw one. That defect existed only on the
0.8.x backport, whose 0.8.1 notes the sentence was taken from; on main the
helper has looked the parameter up as JSON since #188 introduced it. What
0.8.0 did on main was silently replace a protected "epk" with the generated
one, and leave one in the shared or a per-recipient header beside it.

The RSA private-member entry gave "imported as a public key" as the outcome
for every valueless form. That is true of an empty, null or padding-only
member (#189, #192) but not of a zero one (#193), which imported as a private
key whose export cjose could not read back, as the 0.8.1 section below it
already says.

The Compatibility paragraph counted three rules that refuse input 0.8.0
accepted and missed two: the "oth" refusal of #190, since 0.8.0 knew no such
member and imported a multi-prime key as a two-prime one, and the refusal of
an "epk" naming a private member of #186. It also listed "iv", "tag" and
"p2s" as if 0.8.0 had accepted them, when the algorithms that use them are
new in this release. The paragraph now names the rules without counting them.

Signed-off-by: Hans Zandbelt <hans.zandbelt@openidc.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
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.

1 participant