Add configurable RFC 7093 subject key identifiers - #5769
Open
nokitoino wants to merge 1 commit into
Open
Conversation
Owner
|
TBH was unaware of this RFC. Extension changes look fine on first glance. Revert all of the issuance changes ( |
randombit
reviewed
Jul 28, 2026
| @@ -121,6 +121,15 @@ class BOTAN_PUBLIC_API(2, 0) Subject_Key_ID final : public Certificate_Extension | |||
| */ | |||
| explicit Subject_Key_ID(const Public_Key& pub_key); | |||
Owner
There was a problem hiding this comment.
This constructor is anyway new (not yet in any release) so could change it now to always take a Subject_Key_ID_Method and default to SHA-1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Subject_Key_ID_Methodwith explicit choices for RFC 5280section 4.2.1.2 method 1 and RFC 7093 section 2 methods 1, 2, and 3
Subject_Key_ID(const Public_Key&, Subject_Key_ID_Method)constructor
X509_CA::choose_extensions(),both
X509_CA::sign_request()variants, andX509::create_self_signed_cert()existing call
P-256 vector, and cover SHA-1, SHA-384, SHA-512, invalid input, CA-issued
certificates, and self-signed certificates
RFC 5280 method 1 hashes the value of the
subjectPublicKeyBIT STRINGwith SHA-1 and produces 20 bytes. RFC 7093 methods 1, 2, and 3 hash the
same BIT STRING value with SHA-256, SHA-384, or SHA-512 and retain the
leftmost 160 bits.
The certificate signature hash and the SKI derivation method remain
independent. For example, a certificate may be signed with SHA-256 while
retaining the existing RFC 5280/SHA-1 SKI default, or it may explicitly
request an RFC 7093/SHA-256 SKI.
AKI handling is unchanged. A CA-issued certificate continues to copy the
issuer certificate's SKI byte-for-byte into its AKI. A self-signed
certificate uses its newly derived SKI as its AKI.
Compatibility
This change is additive. Existing source calls retain their signatures and
behavior:
Subject_Key_ID(const Public_Key&)still uses RFC 5280 method 1X509_CA::sign_request()overloads still use RFC 5280 method 1X509_CA::choose_extensions()overload still uses RFC 5280method 1
X509::create_self_signed_cert()overload still uses RFC5280 method 1
choose_extensions()compatibility overload remain available andunchanged
Consequently, RFC 7093 output is produced only when a caller uses a new
overload and explicitly selects an RFC 7093 enum value.
The automatic SHA-1 behavior was introduced independently by #5735. Before
#5735, automatic certificate generation used the certificate signature hash
over the DER-encoded
SubjectPublicKeyInfoand truncated digests longer than24 bytes. Thus, upgrading across #5735 can change SKI values without a caller
changing its source code. This PR does not introduce another implicit
behavior change; it preserves #5735's default and adds an explicit opt-in.
RFC 7093 method 4 is deliberately out of scope. It hashes the DER-encoded
SubjectPublicKeyInforather than thesubjectPublicKeyBIT STRING and doesnot prescribe the same fixed 160-bit result as methods 1 through 3.
Related: #3479 and #5735
Testing
make -j4 testsenv LD_LIBRARY_PATH=. ./botan-test x509_unitX509 subject key id derivation: 9 tests passedX509 Unit: 339 tests passedx509, ECDSA/P-256, RSA, SHA-1, and SHA-256,but without the
sha2_64modulex509_unit: 658 tests passedpython3 src/scripts/ci_check_headers.py build/build_config.jsonpython3 src/scripts/ci_check_generated_files.py --base upstream/mastermake docsgit diff --checkDisclosure
This patch was developed with GPT-5.6. Sol.