Skip to main content

Security and Authentication

6.1 Authentication Mechanisms Overview

UCP supports four authentication mechanisms, each suited to different security requirements:

API Keys

Suitable for scenarios that do not require user identity (e.g., browsing the public product catalog):
API Keys typically distinguish between test (ucp_pk_test_) and production (ucp_pk_live_) environments.

OAuth 2.0

See Chapter 3 for details. Used in scenarios that require acting on behalf of a consumer (checkout, order queries, etc.). UCP mandates the Authorization Code + PKCE flow.

mTLS (Mutual TLS)

Mutual TLS authentication requires both client and server to present certificates. Suitable for high-security communication between platforms:
mTLS follows RFC 8705 OAuth 2.0 Mutual-TLS Client Authentication and can be combined with OAuth 2.0.

HTTP Message Signatures (RFC 9421)

UCP Webhook notifications and critical API calls use HTTP Message Signatures to ensure integrity and authenticity. This is one of the most important mechanisms in the UCP security model.

6.2 JWK Signing Keys

Merchants publish their signing public keys in the /.well-known/ucp Profile using the JSON Web Key (JWK) format:
JWK Field Reference: Key Rotation: Merchants can publish multiple keys simultaneously in the signing_keys array (distinguished by different kid values), enabling smooth key rotation. Old keys are retained during the transition period while new signatures use the new key.

6.3 HTTP Message Signatures (RFC 9421)

Signature Creation (Merchant Side)

When a merchant sends a Webhook, it creates a signature following the RFC 9421 standard: Step 1: Compute the Content-Digest of the request body (RFC 9530)
Step 2: Define the Signature-Input
Signature component reference:
  • @method: HTTP method (e.g., POST)
  • @target-uri: Full request URI
  • content-digest: Request body digest
  • content-type: Content type
  • created: Signature creation timestamp (Unix time)
  • keyid: Corresponds to the JWK kid in the Profile
  • alg: Signature algorithm
Step 3: Construct the signature base string
Step 4: Sign the base string using the private key (ES256)

Signature Verification (AI Agent Side)

6.4 Content-Digest (RFC 9530)

The Content-Digest header provides integrity verification for the request body, preventing tampering during transmission:
How to compute:
Content-Digest works in tandem with HTTP Message Signatures — the signature covers the Content-Digest header, and the Content-Digest covers the request body, forming a complete security chain.

6.5 Transport Security

6.6 Data Security and Privacy

UCP establishes clear security boundaries for data handling:

6.7 Security Best Practices

  1. Key rotation: Rotate JWK signing keys regularly. Publish both old and new keys in the Profile simultaneously to ensure a smooth transition.
  2. Rate limiting: Implement reasonable rate limits on all UCP endpoints.
  3. Audit logging: Maintain complete audit logs for all checkout and order operations.
  4. Signature time window: The created timestamp in Webhook signatures should be within 5 minutes.
  5. Token security: Access tokens must not appear in URL parameters or log files.
  6. CORS: UCP API endpoints should be configured with strict CORS policies.
  7. Input validation: All input parameters must be strictly validated for type and range.

Next chapter: Merchant Integration Guide/.well-known/ucp Profile deployment and capability declaration