Ap2 cryptographic signing

From OrcaQubits/agentic-commerce-skills-plugins · View interactive version

Ap2 cryptographic signing is an AI agent skill from the GitHub repository OrcaQubits/agentic-commerce-skills-plugins. Implement AP2 cryptographic signing — hardware-backed user signatures, merchant entity signatures, VDC integrity, key management, and attestation flows. Use when building the signing, verification, and key management components of AP2 mandates.

How to use this skill

Skill file

AP2 Cryptographic Signing

Before writing code

Fetch live docs:

  1. Fetch https://ap2-protocol.org/ap2/specification/ for cryptographic signing requirements
  2. Fetch https://ap2-protocol.org/ap2/security_and_privacy_considerations/ for security architecture
  3. Web-search site:github.com google-agentic-commerce AP2 signature mandate for signing implementations
  4. Web-search ap2 protocol VDC signing cryptographic hardware-backed for community guides

Conceptual Architecture

Why Cryptographic Signing Matters

AP2's core innovation is verifiable intent — cryptographic proof that:

VDC Credential Format

AP2 VDCs use the SD-JWT with Key Binding (+kb) format, enabling selective disclosure and cryptographic holder binding.

Supported Signing Algorithms

AP2 supports ECDSA with the following algorithm/curve combinations:

JSON Canonicalization (JCS)

Before signing, JSON payloads are canonicalized using JCS (RFC 8785) to produce a deterministic byte representation. This ensures that logically equivalent JSON objects produce the same signature regardless of key ordering or whitespace.

Merchant authorization envelope

Version-sensitive. The exact envelope for the merchant's signature has changed across AP2 releases — earlier releases used a detached JWS over canonicalized cart contents; current releases carry a merchant-signed checkout JWT plus a checkout hash inside the mandate. Fetch https://ap2-protocol.org/ap2/checkout_mandate/ and implement what it says. Everything below is the durable shape, not a schema.

The durable pattern, whatever the envelope:

Header claims must carry, at minimum:

Payload claims typically carry issuer, audience, issued-at, expiry, a unique identifier, and the checkout hash. Confirm the exact claim names and the permitted algorithms against the live spec before implementing verification.

Two Types of Signatures

User Signatures
Merchant Signatures

What Gets Signed

| Mandate | Signed by | What's covered |

|---------|-----------|----------------|

| Checkout Mandate (closed) | Merchant + User | Exact items, prices, totals, payment methods |

| Checkout Mandate (open) | User, then Agent on binding | Shopping constraints (allowed merchants, line items), expiry |

| Payment Mandate | User | Payment method selection, transaction amount |

The open form is where the former "Intent Mandate" lives — the user signs the constraints, the agent later signs the binding to a real transaction, and both signatures are retained as the authorization chain.

Trusted Device Surface

The user signing step (especially for Cart and Payment Mandates) involves:

  1. Shopping Agent triggers redirect to trusted device surface
  2. User's device displays the transaction summary
  3. User authenticates (biometric, PIN, passkey)
  4. Device generates signature using hardware-backed key
  5. Attestation object created proving the signing context
  6. Signature + attestation returned to Shopping Agent

This is a load-bearing security step — the agent cannot bypass it.

Signature Verification

Verifiers check:

  1. Signature validity — Cryptographic verification against the signer's public key
  2. Signer identity — Public key belongs to the claimed entity
  3. Content integrity — Signed content matches the mandate contents
  4. Temporal validity — Signature was created within acceptable timeframe
  5. Attestation validity — Device attestation is genuine (for user signatures)

Non-Repudiation

Signed mandates provide non-repudiation for disputes:

Key Management Considerations

Man-in-the-Middle Prevention

VDC signatures prevent MITM attacks:

Best Practices

Fetch the specification for exact signature formats, supported algorithms, attestation requirements, and verification procedures before implementing.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.