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.

CryptographyAES-GCMTLSSGXAttestationJWTP-256ECDH

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.

Mental model

Each mechanism answers one question

Who am I talking to?
TLS / mTLS
Am I allowed to do this?
OAuth / JWT
Is this the trusted hardware?
DCAP · PCCS · MRENCLAVE
How do we create a secret?
P-256 + ECDH
How do we make an AES key?
SHA-256 KDF
How do we encrypt the payload?
AES-128-GCM
How do we protect metadata?
AAD
How is each encryption unique?
12-byte IV

Short definitions

Each term below has one short definition. Hover over a card to see it move.

P-256

A curve that makes key pairs

ECDH

A way to agree on a secret

Shared secret

The raw ECDH output. It is not an AES key.

SHA-256

A hash for fingerprints, keys, and integrity

Context label

A name that keeps derived keys separate

AES-128

Encryption with a 16-byte key

GCM

Encryption with tamper detection

Rijndael

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

P-256

Private stays home. Public can travel.

sk

Private key

never leaves the holder

pk

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.

Same curve, two jobs

P-256 does ECDH and signatures

P-256

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

ECDH animation

Agree on a secret without sending the secret

Party A

skA locked
pkA shareable
pkA →
← pkB

Party B

skB locked
pkB shareable
STEP 1 / 4

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.

Key derivation

ECDH is not an AES key yet

P-256
↓
ECDH
↓
Shared secret
↓
SHA-256
↓
AES-128 key

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

SHA-256

Any input → always 32 bytes

any input bytes…
SHA-256 →
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

Domain separation

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.

AES

A block cipher. It changes plaintext and a key into ciphertext.

AES-128

AES with a 16-byte key (the first 16 bytes of SHA-256).

Rijndael

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)

AES-GCM

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.

12-byte IV

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

AES-GCM envelope

Metadata stays readable. Payload does not.

AAD — visible, authenticated
IV — 12 bytes
Tag — 16 bytes
Ciphertext — encrypted payload

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.

TLS

A secure network connection. The server proves itself with a certificate.

mTLS

TLS where both sides prove who they are.

eTLS

TLS that ends inside the enclave, not in the host OS.

TLS vs mTLS

One-way identity vs both sides prove who they are

Client

server cert →

Server

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.

Attestation

Remote proof of what runs inside the enclave.

DCAP

The Intel stack that checks quotes for SGX.

PCCS

The source of the certificates, CRLs, and TCB data that a quote check needs.

MRENCLAVE

A measurement of the enclave code and its initial state.

Attestation

Prove what code is running inside the enclave

01Enclave quote

Measurement + REPORTDATA

02PCCS collateral

Certs, CRLs, TCB, QE identity

03DCAP / QVL

Verify the quote

04MRENCLAVE pin

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.

OAuth

A protocol that grants access. It does not prove the identity of the hardware.

JWT

A signed token with claims: who, what, and until when.

ES256

ECDSA with P-256 and SHA-256. It signs the JWT.

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.

Filename

A label for people. Someone can change the bytes under it.

Content hash

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

P-256A curve that makes key pairs
ECDHA way to agree on a secret
Shared secretThe raw ECDH output. It is not an AES key.
SHA-256A hash for fingerprints, keys, and integrity
Context labelA name that keeps derived keys separate
AES-128Encryption with a 16-byte key
GCMEncryption with tamper detection
RijndaelThe original name of the AES algorithm family
12-byte IVA value that makes each encryption unique
AADData that stays readable but is protected from change
TLSA secure network connection
mTLSTLS where both sides prove who they are
eTLSTLS that ends inside an enclave
DCAPThe SGX tool that checks attestation
PCCSThe source of data for quote checks
MRENCLAVEThe fingerprint of the enclave code
REPORTDATAThe field that links a quote to your data
OAuthA protocol that grants permission
JWTA signed token that carries permission
ES256A P-256 ECDSA signature
Local attest + DHA secure channel between two enclaves

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.

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░