Skip to content

Load TLS certificate chains and private keys from memory - #664

Merged
bsergean merged 1 commit into
masterfrom
feature/tls-memory-certificates
Nov 18, 2026
Merged

bsergean merged 1 commit into
masterfrom
feature/tls-memory-certificates

Conversation

@bsergean

Copy link
Copy Markdown
Collaborator

Applications can already supply CA bundles as PEM strings, but local client/server certificates and keys require files. Extend the same convention to certFile and keyFile, allowing TLS credentials to stay in memory.

  • Accept file paths or PEM contents independently for certificate chains (leaf first) and matching unencrypted private keys. Support both clients and servers with OpenSSL, mbedTLS, and Network.framework, without temporary credential files.
  • Share OpenSSL credential loading between client/server paths, preserve intermediate certificates, reject load/key-match failures immediately, and suppress password prompts for unsupported encrypted keys.
  • Recognize PEM credentials in SocketTLSOptions::isValid() and redact in-memory PEM from getDescription(). SecureTransport explicitly rejects in-memory client credentials; its existing implementation has no local-certificate loading path.
  • Document the existing fields and backend limitation. Add fast shared tests for file/PEM combinations, mutual TLS, intermediate-chain delivery, malformed certificates/keys, encrypted-key rejection, and diagnostic redaction.

Validation:

  • Full OpenSSL 3 suite: 34/34 test executables pass.
  • New credential cases pass with OpenSSL 1.1.1 and 3.6, mbedTLS 3 and 4, and Network.framework; OpenSSL 1.1.1 builds with deprecated APIs disabled.
  • SecureTransport option/rejection tests pass.
  • Network.framework builds with -Werror=deprecated-declarations; its CLI links no OpenSSL libraries.
  • Production C++11 with -pedantic-errors; formatting and whitespace checks pass. New integration cases run in milliseconds with no sleeps.

Fixes #533.

@bsergean
bsergean merged commit 6382f78 into master Nov 18, 2026
14 checks passed
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.

No Support for loading Client Server Certs from memory

1 participant