Align DPS and IoT Hub CSR APIs#3429
Open
maximsemenov80 wants to merge 2 commits intoAzure:feature/dps-csr-previewfrom
Open
Align DPS and IoT Hub CSR APIs#3429maximsemenov80 wants to merge 2 commits intoAzure:feature/dps-csr-previewfrom
maximsemenov80 wants to merge 2 commits intoAzure:feature/dps-csr-previewfrom
Conversation
Parse the bare JSON array of base64-encoded DER certificates returned in the 200 Completed response, mirroring the DPS issuedCertificateChain parsing but with a bounds check against the configurable max chain size. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Thank you for your contribution @maximsemenov80! We will review the pull request and get back to you soon. |
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
Add parsing of the IoT Hub CSR completed (200) response to align with the existing DPS implementation.
The DPS client already parses
issuedCertificateChainfrom the registration response into anaz_span[]array with a configurable max size. The IoT Hub CSR API was missing equivalent parsing for its completed response — the sample was just logging the raw payload. This PR mirrors the DPS approach so both services expose certificate chains the same way.Changes
az_iot_hub_client.h— Addaz_iot_hub_client_certificate_signing_completed_responsestruct withissued_certificate_chain_count/issued_certificate_chain[]fields (matching DPS'saz_iot_provisioning_client_registration_statecertificate chain fields) andAZ_IOT_HUB_CLIENT_MAX_ISSUED_CERTIFICATE_CHAIN_SIZE(default 3, same as DPS).az_iot_hub_client_csr.c— Implementaz_iot_hub_client_certificate_signing_request_parse_completed_response()to parse the top-level JSON array of base64-encoded DER certificates, mirroring the DPSissuedCertificateChainarray parsing logic.paho_iot_hub_csr_sample.c— Replace raw payload logging with structured parsing using the new API, iterating and logging each certificate in the chain.test_az_iot_hub_client_csr.c— Add precondition checks (null args) and functional tests (multi-cert chain, single cert, empty array).