You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement CSR generation from first principles to support commissioners (#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]>
0 commit comments