Skip to content

Use certificate_chain_file for intermediate cert support - #3

Merged
hellerve merged 1 commit into
mainfrom
claude/certificate-chain-file
Jun 5, 2026
Merged

hellerve merged 1 commit into
mainfrom
claude/certificate-chain-file

Conversation

@carpentry-agent

Copy link
Copy Markdown

Summary

  • Switch SSL_CTX_use_certificate_file to SSL_CTX_use_certificate_chain_file in TlsServerCtx_create_ so intermediate certificates in the PEM file are preserved during the TLS handshake.

This is the one useful change extracted from #2, which was otherwise churn.


Opened by the carpentry-org heartbeat agent (Claude). Veit has not reviewed this yet.

SSL_CTX_use_certificate_file only loads a single certificate.
Switch to SSL_CTX_use_certificate_chain_file so intermediate
certificates in the PEM file are preserved during the TLS
handshake.

@carpentry-reviewer carpentry-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build & Tests

Build: pass — type-checks clean, CI green on macOS and Ubuntu.
Tests: pass — all tests pass, including the server certificate loading tests (self-signed cert/key generation, TlsServerCtx.create with valid and invalid paths, loopback TLS echo, end-to-end accept test).

Findings

No issues.

Verified:

  • Return semantics preserved: Both SSL_CTX_use_certificate_file and SSL_CTX_use_certificate_chain_file return <= 0 on error, so the existing error check at line 335 remains correct.
  • SSL_FILETYPE_PEM removal correct: SSL_CTX_use_certificate_chain_file only supports PEM format and does not take a format parameter — the removal is required by the API signature.
  • Client-side not affected: The client context (carp_tls_get_client_ctx, lines 42-58) does not load certificates; it only configures verification. No corresponding change needed.
  • Test helpers: The inline server in test/test_helpers.h:167 still uses SSL_CTX_use_certificate_file — this is fine, it's a standalone echo server in a child process, not the main code path.
  • No CHANGELOG exists in the repo, so nothing to update.

The change is well-motivated: SSL_CTX_use_certificate_chain_file preserves intermediate certificates in the PEM file during the TLS handshake, which SSL_CTX_use_certificate_file does not. This matters for real-world deployments using certificate chains.

Verdict: merge

Correct one-line change with clear benefit, green CI, comprehensive test coverage of the affected path. Clean to merge.

@hellerve
hellerve merged commit 08293f0 into main Jun 5, 2026
2 checks passed
@hellerve
hellerve deleted the claude/certificate-chain-file branch June 5, 2026 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant