Swift Crypto implements much of the Apple CryptoKit API for Linux and other non-Apple platforms, with a CryptoExtras module for extra server-oriented APIs.
Overview
Swift Crypto is an open-source cryptography package aligned with Apple CryptoKit. On Apple systems where CryptoKit already exists, it re-exports CryptoKit instead of duplicating work. On Linux, ARM64 Windows, and similar targets it builds BoringSSL and XKCP-backed implementations plus shared API code.
The Crypto product exposes hashing, HMAC, symmetric ciphers such as AES and ChaChaPoly, elliptic-curve key agreement and signatures, HPKE, HKDF, and related types without relying on specialized hardware-only APIs. CryptoExtras adds primitives aimed at server scenarios; depending on it can bundle the BoringSSL implementation on any platform.
New APIs may land in Staging when they are expected in CryptoKit, or in Server when they are server-only and not destined for general CryptoKit. The project intentionally avoids unsafe legacy algorithms.
Consumers add the package through Swift Package Manager and import Crypto in application or server code.
Key features
- SHA-2 and SHA-3 hash functions
- HMAC and symmetric keys
- AES and ChaChaPoly ciphers
- Curve25519 and NIST P-curves
- HPKE and shared secrets
- HKDF key derivation
- CryptoKit-compatible public API
- CryptoExtras server extensions
Use cases
- Cross-platform Swift server cryptography
- Linux and ARM64 Windows CryptoKit parity
- Hashing and message authentication in apps
- Public-key encryption and key agreement