Skip to main content

TLS & HTTPS

Prism supports TLS natively through Network.framework — no OpenSSL, no BoringSSL, no external dependencies. Load a PKCS#12 certificate, set your minimum protocol version, and your server speaks HTTPS.

TLS Configuration

Enable HTTPS

TLS Versions

Choose the minimum protocol version your server accepts:
Version Options
TLS 1.0 and 1.1 are deprecated and have known vulnerabilities. Use .tlsv12 as the minimum unless you need to support very old clients. For new deployments, prefer .tlsv13.

HSTS Middleware

HTTP Strict Transport Security tells browsers to always use HTTPS. This prevents protocol downgrade attacks and cookie hijacking:
HSTS Headers

Security Headers

PrismSecurityHeadersMiddleware adds a suite of protective headers to every response:
Security Headers
This adds:
  • X-Content-Type-Options: nosniff — prevents MIME type sniffing
  • X-Frame-Options: DENY — blocks clickjacking via iframes
  • X-XSS-Protection: 1; mode=block — enables browser XSS filter
  • Referrer-Policy: strict-origin-when-cross-origin — controls referrer leakage

Production Setup

A typical production configuration combines all security layers:
Production Security Stack

Creating a PKCS#12 Certificate

Convert PEM certificate and key to PKCS#12 format:
Convert to PKCS#12
For development, create a self-signed certificate:
Self-Signed Certificate
For local development, run without TLS on port 8080. Use TLS only in staging and production. The HSTS middleware is safe to add in development — it only affects responses, and browsers won’t enforce it for localhost.
Prism uses Apple’s Security framework (SecPKCS12Import) for certificate loading. This is the same system used by iOS and macOS apps — battle-tested and maintained by Apple.