Skip to content

Align DPS and IoT Hub CSR APIs#3429

Open
maximsemenov80 wants to merge 2 commits intoAzure:feature/dps-csr-previewfrom
maximsemenov80:feature/dps-csr-preview
Open

Align DPS and IoT Hub CSR APIs#3429
maximsemenov80 wants to merge 2 commits intoAzure:feature/dps-csr-previewfrom
maximsemenov80:feature/dps-csr-preview

Conversation

@maximsemenov80
Copy link
Copy Markdown

@maximsemenov80 maximsemenov80 commented Apr 1, 2026

Summary

Add parsing of the IoT Hub CSR completed (200) response to align with the existing DPS implementation.

The DPS client already parses issuedCertificateChain from the registration response into an az_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 — Add az_iot_hub_client_certificate_signing_completed_response struct with issued_certificate_chain_count / issued_certificate_chain[] fields (matching DPS's az_iot_provisioning_client_registration_state certificate chain fields) and AZ_IOT_HUB_CLIENT_MAX_ISSUED_CERTIFICATE_CHAIN_SIZE (default 3, same as DPS).
  • az_iot_hub_client_csr.c — Implement az_iot_hub_client_certificate_signing_request_parse_completed_response() to parse the top-level JSON array of base64-encoded DER certificates, mirroring the DPS issuedCertificateChain array 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).

maximsemenov80 and others added 2 commits March 30, 2026 19:00
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>
@github-actions github-actions bot added Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Apr 1, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

Thank you for your contribution @maximsemenov80! We will review the pull request and get back to you soon.

@maximsemenov80 maximsemenov80 marked this pull request as ready for review April 1, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant