-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement CSR generation from first principles to support commissione…
…rs (#18631) * Implement CSR generation from first principles to support commissioners - When a commissioner is backing their key with OS or hardware support, the built-in P256Keypair::NewCertificateSigningRequest will not be usable since it relies on internal P256Keypair base class access to key state, as opposed to just using Pubkey() and ECDSA_sign_message primitives. This is OK on some embedded usecases that make use of P256Keypair backend directly, but not for many other usecases. - On iOS/Darwin and on native Android, backing the P256Keypair * by derived classes is bridgeable to platform APIs, but those platform APIs do not offer easy/direct CSR generation, and on Darwin, there are not ASN.1 APIs anymore. - If trying to make use of Darwin APIs introduced in #18519, there is no easy way to write code interfacing with an external CA to provide a CSR for a natively bridged keypair. This PR adds a first-principle CSR generator, written and audited by Google personel, using the ASN1Writer API already used in CHIPCert.h and used by all Commissioner code making use of SDK today. This is a straightforward implementation that directly uses a P256Keypair * (or a derived class thereof!) to generate a CSR against it, without depending on direct key access like like the native version P256Keypair::NewCerticateSigningRequest does. This PR also fixes constness of operations on P256Keypair. Issue #18444 Testing done: - Added unit tests for the new primitive - Validated generated CSR with OpenSSL - Validated equivalence to generated CSR from P256Keypair, on both mbedTLS and OpenSSL - Not used by CHIP-tool but usable by Darwin and Android framework users. * Update src/crypto/CHIPCryptoPAL.h Co-authored-by: Boris Zbarsky <[email protected]> * Fix CI * Restyled by clang-format Co-authored-by: Boris Zbarsky <[email protected]> Co-authored-by: Restyled.io <[email protected]>
- Loading branch information
Showing
12 changed files
with
299 additions
and
30 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.