What problem does it solve?
This Skill helps you implement correct, secure cryptography in Swift by providing vetted patterns for hashing, authentication (HMAC), authenticated encryption, digital signatures, and key agreement using Apple CryptoKit.
Core Features & Use Cases
- Hashing with SHA256/SHA384/SHA512: Use one-shot or incremental hashing for data integrity and content fingerprints.
- HMAC authentication codes: Generate and verify HMACs with constant-time verification for message authenticity.
- Authenticated encryption (AES-GCM / ChaChaPoly): Encrypt and decrypt with automatic nonce handling and built-in authentication-tag verification.
- Public-key signing and verification: Sign and verify using P256/P384/P521 (ECDSA) and Curve25519 (Ed25519).
- Key agreement (ECDH) and key derivation: Derive symmetric keys from shared secrets via HKDF with proper sharedInfo binding.
- Secure Enclave key storage: Use hardware-backed P256 keys with availability checks and Keychain persistence of dataRepresentation.
Quick Start
Use the cryptokit skill to implement AES-GCM encryption and decryption for confidential app payloads while ensuring authenticated tag verification and safe key handling.