Security18 min read
Crypto Terms: A Practical Glossary
Learn the main terms of a secure enclave system, such as keys, hashes, encryption, and attestation, and the question that each term answers.
Cryptography is easier when you treat each mechanism as the answer to one question. The same curve does two jobs. AES-GCM and TLS protect different layers. Attestation is not authorization.
Each mechanism answers one question
Short definitions
Each term below has one short definition. Hover over a card to see it move.
A curve that makes key pairs
A way to agree on a secret
The raw ECDH output. It is not an AES key.
A hash for fingerprints, keys, and integrity
A name that keeps derived keys separate
Encryption with a 16-byte key
Encryption with tamper detection
The original name of the AES algorithm family
NIST P-256
P-256 (also named secp256r1 or prime256v1) is an elliptic-curve group. NIST standardized it. It makes a public/private key pair through scalar multiplication.
P-256 = the math used to create public/private keys
Private stays home. Public can travel.
Private key
never leaves the holder
Public key
safe to publish
public = private × generator point
The system uses the same curve for two operations. ECDH agrees on a secret. ECDSA / ES256 signs a token.
P-256 does ECDH and signatures
ECDH
shared secret
ES256
JWT signature
ECDH
Elliptic Curve Diffie–Hellman lets two parties calculate the same secret without sending it. Each side mixes its own private key with the other side's public key. A network observer sees both public keys but cannot find the secret.
ECDH = two sides calculate the same secret without sending it
Agree on a secret without sending the secret
Party A
Party B
Each side holds a private / public pair
Shared secret and AES key
ECDH makes a raw shared secret. This secret has the wrong shape and the wrong purpose for encryption. A KDF (key derivation function) changes it into an AES key. This system uses SHA-256 as the KDF.
ECDH is not an AES key yet
SHA-256
SHA-256 is a cryptographic hash. Its output is always 32 bytes. This system uses it for three jobs: fingerprints, key derivation, and the hash inside ES256 signatures.
SHA-256 = a hash function that makes a 32-byte fingerprint
Any input → always 32 bytes
Used as fingerprint, KDF, and inside ES256 signatures
Concatenation and domain separation
You hash shared || context. The || symbol means concatenate. The context label states what the derived key is for. Two purposes cannot share a key by mistake.
Context = a label that states what a derived key is for
Same secret + different labels = different keys
SHA256(shared || "payload-v1")
key A
SHA256(shared || "channel-v1")
key B
AES-128 and Rijndael
AES is a block cipher. AES-128 uses a 16-byte key. You take the first 16 bytes of the SHA-256 output. Rijndael is the algorithm family that NIST standardized as AES. An API that says rijndael128 means AES-128.
A block cipher. It changes plaintext and a key into ciphertext.
AES with a 16-byte key (the first 16 bytes of SHA-256).
The original algorithm family. rijndael128 is AES-128.
GCM
Galois/Counter Mode (GCM) makes AES an authenticated encryption method. It hides the data. It also adds a tag. The tag check fails if anyone changes the data.
GCM = encryption with tamper detection (ciphertext and a 16-byte tag)
Hide the bytes. Detect the flip.
Confidentiality
Plaintext becomes ciphertext. Without the key, it is noise.
Integrity / authenticity
16-byte tag binds ciphertext + AAD
IV or nonce
GCM needs a 12-byte IV (initialization vector). Never use the same AES key and IV pair two times. Put a counter in the first 4 bytes and zeros in the rest. Each encryption is then unique. If the receiver accepts only a higher counter, replayed messages fail.
Never reuse (key, IV) for two plaintexts
4-byte counter
1
8-byte zeros
00…
IV = 01 00 00 00 00 00 00 00 00 00 00 00
AAD
Additional Authenticated Data (AAD) goes into the GCM tag but stays unencrypted. Routing data can stay readable. If anyone swaps it, reorders it, or attaches it to a different job, the tag check fails.
AAD = readable data that is protected from change
Metadata stays readable. Payload does not.
TLS, mTLS, and eTLS
Application AES-GCM hides the payload from an untrusted relay. TLS hides the connection from a network observer. You use both. One does not replace the other.
A secure network connection. The server proves itself with a certificate.
TLS where both sides prove who they are.
TLS that ends inside the enclave, not in the host OS.
One-way identity vs both sides prove who they are
server cert →
Client checks the server. Server may not know the client.
Attestation, DCAP, PCCS, and MRENCLAVE
Remote attestation is proof of which software runs inside an SGX enclave. The enclave makes a quote. DCAP checks the quote. PCCS gives DCAP the data it needs. MRENCLAVE is the code fingerprint that you pin.
Remote proof of what runs inside the enclave.
The Intel stack that checks quotes for SGX.
The source of the certificates, CRLs, and TCB data that a quote check needs.
A measurement of the enclave code and its initial state.
Prove what code is running inside the enclave
Measurement + REPORTDATA
Certs, CRLs, TCB, QE identity
Verify the quote
Accept only the expected fingerprint
REPORTDATA
REPORTDATA is a 32-byte field inside the quote. Put a public key and a fresh challenge into it. An attacker then cannot pair a valid quote with the attacker's key.
REPORTDATA = the field that links a quote to your data, usually SHA-256(version || pubkey || challenge)
OAuth, JWT, and ES256
Attestation answers "Is this the correct enclave?" Authorization answers "Is this caller allowed?" OAuth issues a JWT. ES256 signs the JWT with P-256 ECDSA.
A protocol that grants access. It does not prove the identity of the hardware.
A signed token with claims: who, what, and until when.
ECDSA with P-256 and SHA-256. It signs the JWT.
Three dots. One signature.
header
alg: ES256
payload
claims, expiry
signature
ECDSA P-256
Content hash as identity
A filename is a label for people. The SHA-256 hash of the bytes is a cryptographic identity. Authorization can then allow one exact piece of content.
A label for people. Someone can change the bytes under it.
The cryptographic identity of the exact bytes.
Local attestation and DH
Two enclaves on the same platform prove their identity to each other. They then run Diffie–Hellman. The host OS cannot read the traffic between the enclaves.
Local attest + DH = a secure channel between two enclaves on one machine
Cheat sheet
Summary = mTLS checks the network. OAuth/JWT grants permission for the job. DCAP/PCCS proves the enclave. P-256/ECDH makes a shared secret. SHA-256 derives the AES key. AES-128-GCM protects the payload. AAD protects metadata. Local attestation protects traffic between enclaves.
Signup for Updates:
I promise to only email you cool shit. Draft chapters, progress updates, sneak peaks at illustrations I'm working on. Stuff like that.