Updated July 2026 for receipt format v3. Device receipts can carry a client attestation and a gateway countersignature when both ran. The desktop app, browser extension or in-browser engine that tokenizes the request can sign a receipt with a locally generated ECDSA P-256 key, and the gateway can add a countersignature for the relay facts only it sees. The wire format is OpenReceipt v3 ("v":"v3", alg ecdsa-p256-sha256), specified at signedreceipts.org/spec. The recipe below follows v3; v1 and v2 receipts still verify under §4.0 of the spec.
The trust problem with privacy claims
When a vendor says “we don’t retain your prompts,” you have no way to check it. You can read their privacy policy, ask their sales team or hire a penetration tester, and none of that produces cryptographic evidence. At best you get a point-in-time audit report, which shows controls were in place during a sample period, not that a specific request was handled correctly.
An issued OpenReceipt can be checked independently. It is a small JSON envelope of signed claims. When both client and gateway signing ran, it carries an attestation from the device that tokenized the request, followed by a gateway countersignature for the relay facts the gateway can attest to. If a chain link is present, it records the prior receipt position claimed by this envelope; a standalone receipt does not prove the full request history is present.
You do not need a CloakAPI account to check a receipt, and you do not need to call our API. A v3 receipt carries the client’s public key, so you need the receipt, the gateway key set for the countersignature, and about thirty lines of Python.
The cryptographic primitives
ECDSA P-256 with SHA-256
Receipts are signed with ECDSA over the NIST P-256 curve (also called secp256r1 or prime256v1), with SHA-256 as the hash. The v3 envelope labels this alg as ecdsa-p256-sha256; RFC 7518, the JSON Web Algorithms specification, calls the same primitive ES256. P-256 is supported by every major cryptographic library, is FIPS 186-4 compliant, and produces compact 64-byte signatures.
The client’s signing key is generated on the device. Its public key travels inside the receipt (§8.2 of the spec), so an offline verifier does not need to contact anyone to check the client signature. The gateway’s countersignature key is held server-side in software, with no HSM, and its public key is published at the endpoint below.
RFC 8785 JSON Canonicalization Scheme (JCS)
JSON has a serialization ambiguity: the same logical object can be written many ways (key order, whitespace, Unicode escaping). You cannot sign raw JSON and expect someone else to reproduce the same bytes to check the signature.
CloakAPI uses RFC 8785, the JSON Canonicalization Scheme (JCS), to produce a deterministic byte sequence before signing. In JCS, keys are sorted lexicographically by UTF-16 code units; there is no insignificant whitespace; numbers are serialized with IEEE 754 double-precision semantics; and strings use minimal Unicode escaping. The output is valid UTF-8.
In v3 the signed message is the JCS form of the whole envelope with the sig field removed. sig is the raw r || s concatenation (64 bytes), base64url-encoded without padding; DER encoding is rejected. Deterministic nonces per RFC 6979 are recommended so fixtures stay byte-stable. The legacy v1 and v2 envelopes used JOSE and DER shapes, and a conformant v3 verifier dispatches on the v and alg fields and accepts all three.
The JWKS endpoint
CloakAPI publishes its current signing keys at:
GET https://api.cloakapi.io/api/.well-known/cloakapi-receipt-pubkeys.jwksThe response is a standard JWK Set (RFC 7517) with the gateway’s EC public keys, each with "crv": "P-256" and "alg": "ES256" and a kid (key ID). The countersignature in a receipt names its kid, so you know which key to use without trying them all. The active key is flagged with "x-cloakapi-active": true; superseded keys stay published so older countersignatures keep verifying.
The active gateway key from the live set looks like this. The client’s own signing key is not published here, because each v3 receipt carries it.
{
"keys": [
{
"kty": "EC",
"crv": "P-256",
"alg": "ES256",
"use": "sig",
"kid": "gw-prod-2026-q2",
"key_ops": ["verify"],
"x-cloakapi-active": true,
"x": "4pSfa_TppW5WfEkgUuqkMqGhFJ9HXF0OvH-9sIT0vPE",
"y": "xcvkfoFM3TFWjVTucGcbNKnEbJxmGn8gwEZy9Sbh-N8"
}
]
}A v3 receipt envelope
A v3 envelope with a client attestation and a gateway countersignature looks like this, with fields abbreviated:
{
"v": "v3",
"alg": "ecdsa-p256-sha256",
"kid": "device-key-01JZQ7M3F8...",
"iss": "client",
"iat": "2026-04-29T11:03:22.417Z",
"jti": "01HZ9QK4WMFVG3C8XSDQVT7R4P",
"chain": { "prev_hash": null },
"claims": {
"v3-attestation": {
"tier": "gateway-countersigned",
"no_raw_pii_egress": true,
"tokenised_body_hash": "sha256:7f4e3b2a...(64 hex chars)...",
"detector_categories": ["NAME", "MRN", "DATE"],
"engine_ruleset_version": "v1.4.2",
"engine_binary_hash": "sha256:c1a9...",
"genuine_engine": true,
"privacy_tier": "balanced",
"token_binding_hmac": "...(commits to token↔PII bindings, reveals nothing)...",
"anchoring": "beacon",
"attester_public_key": "04<X><Y> (SEC1 uncompressed P-256, 130 hex chars)"
},
"countersignature": {
"iss": "https://api.cloakapi.io",
"kid": "gw-prod-2026-q2",
"provider": "openai",
"sig": "...gateway r||s, base64url..."
}
},
"sig": "...client r||s, base64url (64 bytes)..."
}Two signatures, two parties. The client signature (sig at the top level) is computed by the tokenizing client over JCS(envelope without sig) and checked against the attester_public_key in the receipt, with no lookup. The gateway countersignature (under claims.countersignature) witnesses the relay facts only the gateway sees, such as the provider it forwarded to, and is checked against the key named by its kid.
The attestation carries no personal data. It carries the fields shown above: hashes, category names, an HMAC that commits to the token-to-value bindings without revealing them, the engine’s identity and privacy tier, the attester’s public key, and the relay facts the gateway witnessed.
Verifying offline in Python
The recipe below is self-contained Python whose only runtime dependency is the cryptography package from PyCA. A packaged Python reference library is planned but not published; signedreceipts.org/implementations lists the status of the reference implementations.
The core of the v3 client-signature check needs no network at all, because the signing key is in the receipt:
import json, base64
from cryptography.hazmat.primitives.asymmetric.ec import (
ECDSA, SECP256R1, EllipticCurvePublicKey
)
from cryptography.hazmat.primitives.hashes import SHA256
from cryptography.hazmat.primitives.asymmetric.utils import encode_dss_signature
from cryptography.exceptions import InvalidSignature
def jcs(obj):
"""RFC 8785: sorted keys, no whitespace, minimal escaping."""
return json.dumps(obj, sort_keys=True, separators=(',', ':'),
ensure_ascii=False).encode('utf-8')
def verify_client_sig(receipt: dict) -> bool:
# v3: the client signing key is embedded (SEC1 uncompressed hex, "04"+X+Y)
hexpk = receipt['claims']['v3-attestation']['attester_public_key']
pub = EllipticCurvePublicKey.from_encoded_point(
SECP256R1(), bytes.fromhex(hexpk)
)
# Signed message = JCS of the envelope with the top-level "sig" removed
env = {k: v for k, v in receipt.items() if k != 'sig'}
msg = jcs(env)
# sig is raw r||s (64 bytes), base64url without padding -> DER for PyCA
raw = base64.urlsafe_b64decode(receipt['sig'] + '==')
r = int.from_bytes(raw[:32], 'big')
s = int.from_bytes(raw[32:], 'big')
try:
pub.verify(encode_dss_signature(r, s), msg, ECDSA(SHA256()))
return True
except InvalidSignature:
return FalseThe gateway countersignature uses the same math. The message is JCS(countersignature without its own sig), and the key is rebuilt from the x and y coordinates of the key-set entry named by claims.countersignature.kid. Fetch the key set once and cache it, and both signatures check without contacting us again.
Save the snippet with a small main() as verify.py and run it:
pip install cryptography
python verify.py path/to/receipt.jsonBecause v3 receipts carry the client key, the client signature checks offline. Point the countersignature check at a cached key-set file and the whole check runs without a network call, for example on a machine that has no network access.
Chain links: the chain.prev_hash field
Each v3 envelope carries a chain object whose prev_hash is the SHA-256 hash of the canonical form of the previous receipt in the same chain. The first receipt in a chain uses prev_hash: null.
A chain link can reveal a break within a sequence you hold: if a receipt is removed from the middle, the next receipt’s signed previous hash no longer matches that sequence. A standalone receipt does not reveal whether later receipts or an unobserved tail were omitted. A signed chain export, when available, binds its own ordered entries and tail.
To check a directory of receipts, extend main() with a --chain mode that sorts the receipts by iat, walks prev_hash and reports the first break:
python verify.py --chain receipts/Chains are per client, not global: each tokenizing device keeps its own chain.
What a receipt does not prove
Supported clients tokenize what they detect on the device before sending, and detection is best-effort. The gateway receives and relays request bytes but does not inspect message content for personal data. It checks request authentication and integrity fields, and its countersignature records relay facts it witnessed, such as the selected provider. It cannot verify that a client detector or a specific engine binary ran, or that a person reviewed the text.
A receipt is a signed record of the claims in its envelope. Checking its signatures and hashes shows that those claims have not changed since signing. A client-declared engine hash can be compared with the published allowlist, but that does not prove which binary ran. A receipt also does not prove that every personal-data value was found, or that every request produced one.
Checking a countersignature means trusting the endpoint that serves the gateway’s public key. If an attacker controlled it, they could serve a forged key. To guard against that, keep snapshots of the key set and compare them with the live endpoint over time. Each receipt’s canonical hash can also be anchored in the public transparency log, directly for countersigned receipts or through a content-free beacon, which gives you an independent record to compare against. The client signature needs no such trust, because its key travels with the receipt.
Check a receipt yourself
The OpenReceipt specification and the in-browser verifier are Apache-2.0.
- The docs walk through checking a receipt step by step.
- The public verifier is at signedreceipts.org/verifier, and the spec at signedreceipts.org/spec.
- The conformance suite is documented at signedreceipts.org/conformance.
- You can build your own verifier in any language, because the spec is self-contained. Reference-library source is being prepared at signedreceipts.org/source.
If you are an auditor reviewing a customer’s CloakAPI use, ask the customer for their receipts. You can check everything described here without contacting us.
A receipt shows what was signed, not that nothing was missed. What a receipt does not prove