Skip to content

Accept nonRepudiation when unmarshalling keyUsage #811

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

neverpanic
Copy link
Contributor

Name of feature:

Accepting NonRepudiation when unmarshalling keyUsage.

Pain or issue this feature alleviates:

Better user experience for users that are used to the old name (e.g., from OpenSSL, which still uses the old name exclusively).

Is there documentation on how to use this feature? If so, where?

I didn't add any, because I don't think this should be advertised — but it's nice when it works when somebody attempts it.

Supporting links/other PRs/issues:

smallstep/certificates#2348

Description

ITU-T X.509 (10/2019) section 9.2.2.3 1 defines 'contentCommitment' as the current name for what had previously been called 'nonRepudiation', and deprecates the old name:

It is not incorrect to refer to this keyUsage bit using the identifier
nonRepudiation. However, the use of this identifier has been
deprecated.

The old name is still widely used, though — for example, OpenSSL still supports nonRepudiation exclusively. It is therefore not surprising that users attempt to specify that and just get an error message in return. See for example
Modify the JSON unmarshalling to accept the old name, and transparently convert it to the new one. Keep marshalling the same, since we want to be conservative in what we send, but liberal in what we accept.

Related: smallstep/certificates#2348

Comment on lines 730 to 734
case convertName("nonRepudiation"):
// support legacy name for better user experience for users coming
// from OpenSSL
fallthrough
case convertName(KeyUsageContentCommitment):
Copy link
Member

Choose a reason for hiding this comment

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

Could you combine this into the single case statement instead of the fallthrough? I don't expect the code lines to change order, but just in case. Can you also make the "nonRepudiation" a non-exported constant? I.e. keyUsageNonRepudiation = "nonRepudiation" // old name for contentCommitment key usage

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be fixed now.

@hslatman hslatman self-assigned this Aug 4, 2025
@neverpanic neverpanic force-pushed the cal-allow-keyUsage-nonRepudiation branch from 1a48ef0 to f3c410e Compare August 4, 2025 10:22
@hslatman
Copy link
Member

hslatman commented Aug 4, 2025

@neverpanic just a minor linting issue left now

ITU-T X.509 (10/2019) section 9.2.2.3 [1] defines 'contentCommitment' as
the current name for what had previously been called 'nonRepudiation',
and deprecates the old name:

> It is not incorrect to refer to this keyUsage bit using the identifier
> nonRepudiation. However, the use of this identifier has been
> deprecated.

The old name is still widely used, though — for example, OpenSSL still
supports nonRepudiation exclusively. It is therefore not surprising that
users attempt to specify that and just get an error message in return.
See for example smallstep/certificates#2348.

Modify the JSON unmarshalling to accept the old name, and transparently
convert it to the new one. Keep marshalling the same, since we want to
be conservative in what we send, but liberal in what we accept.

[1]: https://www.itu.int/rec/T-REC-X.509-201910-I/en

Related: smallstep/certificates#2348
Signed-off-by: Clemens Lang <neverpanic@gmail.com>
@neverpanic neverpanic force-pushed the cal-allow-keyUsage-nonRepudiation branch from f3c410e to f0c4a2f Compare August 4, 2025 14:49
@neverpanic
Copy link
Contributor Author

@neverpanic just a minor linting issue left now

Should be fixed now — would be nice if golangci-lint would actually print the suggested formatting changes, rather than just saying "it's wrong"…

@hslatman hslatman merged commit 1267d93 into smallstep:master Aug 5, 2025
12 checks passed
@hslatman
Copy link
Member

hslatman commented Aug 5, 2025

@neverpanic just a minor linting issue left now

Should be fixed now — would be nice if golangci-lint would actually print the suggested formatting changes, rather than just saying "it's wrong"…

Thank you, @neverpanic!

I don't disagree, but I'm not aware of a setting that allows doing so using golangci-lint. It should all be regular go fmt, anyway.

@neverpanic neverpanic deleted the cal-allow-keyUsage-nonRepudiation branch August 5, 2025 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants