cryptokit

Perform cryptographic operations in Swift using Apple CryptoKit.

Updated Mar 31, 2026
One-click install
npx skills add https://github.com/DFly7/iOS-FastAPI-Supabase-AI --skill cryptokit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cryptokit
Source: https://github.com/DFly7/iOS-FastAPI-Supabase-AI/tree/main/.agents/skills/cryptokit
Command: npx skills add https://github.com/DFly7/iOS-FastAPI-Supabase-AI --skill cryptokit

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Helps developers implement correct, modern cryptographic operations in Swift by providing clear patterns and safe defaults for hashing, HMAC, authenticated encryption, signing, key agreement, and Secure Enclave usage so apps avoid common crypto pitfalls.

Core Features & Use Cases

  • Hashing & HMAC: SHA256/SHA384/SHA512 hashing and HMAC generation/verification with constant-time checks.
  • Authenticated Encryption: AES-GCM and ChaChaPoly usage patterns, nonce guidance, AAD handling, and sealed-box anatomy for safe encryption and decryption.
  • Public-Key Operations & Key Agreement: ECDSA/Ed25519 signing, ECDH key agreement with HKDF-based key derivation, signature formats, and interoperability notes.
  • Secure Enclave & Key Storage: Creating, protecting, exporting, and restoring Secure Enclave keys and guidance for Keychain storage and export compliance.
  • Migration & Best Practices: CommonCrypto migration recipes, performance considerations, and a review checklist to validate secure implementations.

Quick Start

Use the cryptokit skill to generate or import keys, derive a symmetric key with HKDF, encrypt data with AES-GCM or ChaChaPoly, and sign or verify a message.

Frequently Asked Questions about cryptokit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement AES-GCM encryption in Swift using CryptoKit?

AES-GCM encryption in Swift using CryptoKit involves generating a symmetric key, creating a nonce, and sealing data into an AES.GCM.SealedBox. You handle associated data (AAD) during encryption and use the sealed box components for safe decryption.

What's the best way to migrate CommonCrypto hashing to CryptoKit SHA256?

Migrating CommonCrypto hashing to CryptoKit SHA256 involves replacing C-style function calls with Swift's HashFunction protocol, using SHA256.hash(data:) for direct digest computation. CryptoKit provides safe defaults and constant-time verification for HMAC operations.

How does Secure Enclave key storage work for iOS apps?

Secure Enclave key storage in iOS apps works by generating ECDSA or Ed25519 keys with the Secure Enclave flag, keeping private keys hardware-backed and non-extractable. You create, protect, and restore these keys while using Keychain for metadata storage.

Can I use CryptoKit for ECDH key agreement and HKDF derivation?

Yes, you can use CryptoKit for ECDH key agreement and HKDF derivation by generating elliptic curve keys, performing key agreement with the peer's public key, and deriving symmetric keys using HKDF with proper salt and info parameters.

How do I sign and verify messages with Ed25519 in Swift?

Signing and verifying messages with Ed25519 in Swift involves generating an Ed25519 private key, creating a signature for your data, and using the corresponding public key for constant-time verification to ensure message authenticity.

What are the limitations of using ChaChaPoly for authenticated encryption in Swift?

ChaChaPoly authenticated encryption in Swift requires careful nonce management to prevent key compromise, and sealed box components must be stored together for successful decryption. Proper key handling and storage are essential limitations to consider.