scdaemon-se

A drop-in replacement for GnuPG’s scdaemon that uses the Apple Secure Enclave for private key storage. Your GPG signing, encryption, and authentication keys are generated inside the Secure Enclave and never leave the hardware.

This project has been built with AI coding assistants.

Overview

scdaemon-se implements the Assuan IPC protocol that gpg-agent uses to talk to smartcard daemons. It presents the Secure Enclave as an OpenPGP-compatible smartcard with three key slots, all using NIST P-256 — the only curve the Secure Enclave supports.

                    Assuan IPC              CryptoKit
  gpg  ───►  gpg-agent  ───►  scdaemon-se  ───►  Secure Enclave
                                    │
                              macOS Keychain
                            (opaque key handles)

The private keys themselves live in the Secure Enclave’s hardware. The macOS Keychain stores only opaque handles (under the service name scdaemon-se) that let CryptoKit reconnect to the hardware keys across reboots. The keys cannot be exported, copied, or read by any software — every cryptographic operation happens inside the Secure Enclave. See Architecture for how the pieces fit together, and Security Model for what that guarantees (and doesn’t).

Key slots

Slot OpenPGP Reference Algorithm Use
1 OPENPGP.1 ECDSA P-256 Signing
2 OPENPGP.2 ECDH P-256 Decryption
3 OPENPGP.3 ECDSA P-256 Authentication

You can also back multiple signing keys with additional virtual cards — see Guides → Multiple signing keys.

Requirements

  • macOS 13+ (Ventura or later) with Apple Silicon or a T2 chip
  • Swift 6.3+
  • GnuPG 2.x — brew install gnupg
  • Xcode — required only for running the unit test suite (Command Line Tools alone are enough to build and run the daemon)

Where to go next

  • Installation — build from source, or via Homebrew
  • Usage — signing, encrypting, decrypting, git commit signing, SSH auth
  • Architecture — how the pieces work together, traced end to end
  • Assuan Reference — exactly which commands are implemented, which are no-ops, and which are refused
  • Security Model — what the Secure Enclave gate does and does not protect against
  • Use Cases — when this is (and isn’t) the right tool

License

MIT. See LICENSE in the repository.


scdaemon-se is licensed under the MIT License.

This site uses Just the Docs, a documentation theme for Jekyll.