cryptokit

Implement cryptographic primitives in Swift using CryptoKit types and APIs.

Updated May 10, 2026
One-click install
npx skills add https://github.com/FelixRauch/medat-figuren --skill cryptokit-felixrauch
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cryptokit
Source: https://github.com/FelixRauch/medat-figuren/tree/main/.agents/skills/cryptokit
Command: npx skills add https://github.com/FelixRauch/medat-figuren --skill cryptokit-felixrauch

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you implement modern, secure cryptographic operations in Swift without error-prone low-level APIs, so you can hash, authenticate, encrypt, and sign data reliably.

Core Features & Use Cases

  • Hashing & Digest Handling: Compute SHA256/SHA384/SHA512 digests (one-shot or incremental) for integrity checks and deterministic fingerprints.
  • Authentication with HMAC: Generate and verify HMAC authentication codes using constant-time validation.
  • Authenticated Encryption: Encrypt and decrypt with integrity using AES-GCM or ChaChaPoly, including support for additional authenticated data (AAD).
  • Signing & Key Agreement: Sign with P256/P384/P521 or Curve25519/Ed25519 and perform ECDH key agreement with HKDF-derived symmetric keys.
  • Secure Enclave Key Storage: Back keys by the Secure Enclave for stronger protection and controlled access using biometric/passcode policies.

Quick Start

Use the cryptokit skill to create a SHA256 digest and verify it against an expected value for integrity checking of incoming data.

Frequently Asked Questions about cryptokit

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

FAQPage Schema
How do I compute a SHA256 hash in Swift for data integrity checks?

To compute a SHA256 hash in Swift, use CryptoKit to generate one-shot or incremental digests. This provides deterministic fingerprints and verifies incoming data against expected values for reliable integrity checks without low-level APIs.

What's the best way to perform authenticated encryption with AES-GCM in Swift?

Authenticated encryption with AES-GCM in Swift uses CryptoKit to encrypt and decrypt data while supporting additional authenticated data. This ensures confidentiality and integrity together, preventing tampering during transmission or storage.

Can I store cryptographic keys in the Secure Enclave using CryptoKit?

Yes, CryptoKit allows you to back keys with the Secure Enclave for stronger protection. This controls access using biometric or passcode policies, ensuring secure key handling for iOS app scenarios requiring strict confidentiality.

How do ECDH key agreement and HKDF work for deriving symmetric keys in Swift?

ECDH key agreement in Swift uses CryptoKit to establish a shared secret between parties, then HKDF derives symmetric keys from it. This enables secure protocol data exchange and on-device authentication without exposing raw private keys.

Does CryptoKit support constant-time validation for HMAC authentication codes?

Yes, CryptoKit supports HMAC generation and verification using constant-time validation. This prevents timing attacks when authenticating user or protocol data, ensuring safe validation checks across iOS app scenarios.

When should I use ChaChaPoly instead of AES-GCM for authenticated encryption?

Use ChaChaPoly for authenticated encryption in Swift when you need an alternative to AES-GCM. CryptoKit applies both to iOS app scenarios requiring confidentiality and integrity, with correct nonce handling ensuring safe data encryption.