Repository navigation
Allow CSRs for encryption-only public keys - #15989
Draft
laasyapriya2007 wants to merge 1 commit into
Draft
laasyapriya2007 wants to merge 1 commit into
laasyapriya2007 wants to merge 1 commit into
Conversation
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.
Closes #15313
Description
Adds
CertificateSigningRequestBuilder.public_key(), which explicitly setsthe public key placed in the CSR's
subjectPublicKeyInfo. This enables CSRsfor encryption-only public keys -- such as ML-KEM and X25519 -- which cannot
sign themselves, by signing the CSR with a different, signature-capable
private key, as described in RFC 9883.
public_key(key)setter onCertificateSigningRequestBuilderaccepting any
CertificatePublicKeyTypes(includingMLKEM768PublicKey,MLKEM1024PublicKey,X25519PublicKey, andX448PublicKey).sign()now uses the explicitly supplied public key for the CSR'ssubjectPublicKeyInfowhile the signature over theCertificationRequestInfois computed with the signing private key. When no public key is set,
behavior is unchanged: the SPKI is derived from
private_key.public_key().create_x509_csrreads_public_keyfrom the builderwhen present, mirroring how
create_x509_certificatealready handlesCertificateBuilder._public_key.MLKEM768PublicKeyCSR signed with anEd25519PrivateKeyand an
X25519PublicKeyCSR signed with an EC key -- asserting the CSRcarries the supplied public key and round-trips through PEM and DER --
plus setter validation and the default backward-compatible path.