Skip to content

Add support for Raw Public Key credentials - #103

Merged
rafaelcepeda merged 4 commits into
swift-server:mainfrom
aryan-25:support-raw-public-keys
Jul 30, 2026
Merged

Add support for Raw Public Key credentials#103
rafaelcepeda merged 4 commits into
swift-server:mainfrom
aryan-25:support-raw-public-keys

Conversation

@aryan-25

Copy link
Copy Markdown
Collaborator

Motivation:

This PR decomposes the existing TLSCredentials type to separate out credential type (X509), source (file, byte array, or certificate reloader), and encoding (PEM or DER) from one another. This allows us to cleanly add support for a new TLS credential type, namely, Raw Public Keys (RFC 7250), which is currently only available over HTTP/3.

Modifications:

Updated TLSCredentials to now be structured around "credential type" as the top-level. TLSCredentials now provides these static factory methods (public):

  • .x509(X509Credentials)
  • .rawPublicKey(RawPublicKeyCredentials)

Internal API:

  • X509Credentials.Backing:

    • .certificates
    • .reloading
    • .serialized(SerializedCredentials).
  • SerializedCredentials:

    • a source (.file / .bytes) combined with a SerializationFormat (.pem / .der).

Internally, we can now represent TLS credentials in a more structured manner. These details are not exposed in the public API though. The public API just contains these convenience factory methods:

  • X509Credentials:

    • .certificates(chain:privateKey:): in-memory X509.Certificate / Certificate.PrivateKey objects;
    • .reloading(_:): a CertificateReloader;
    • .pemFile / .pemBytes / .derFile / .derBytes: a serialized certificate chain and private key.
  • RawPublicKeyCredentials:

    • .derFile.

Result:

Configuration API improved and support for Raw Public Key credentials over HTTP/3 added.

@aryan-25
aryan-25 requested a review from gjcairo July 29, 2026 10:32
@aryan-25 aryan-25 added the ⚠️ semver/major Breaks existing public API. label Jul 29, 2026
@rafaelcepeda
rafaelcepeda merged commit e71e4f4 into swift-server:main Jul 30, 2026
16 of 22 checks passed
@aryan-25
aryan-25 deleted the support-raw-public-keys branch July 30, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚠️ semver/major Breaks existing public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants