# Security & Cryptography

# BDI JWS profile

Every compact JWS produced or consumed by these components must satisfy:

Token type Max lifetime
BVAD 10 minutes
BVOD 60 minutes
OAuth access token 15 minutes
Member descriptor 24 hours
Trustlist 5 minutes (CDN + invalidation)
Webhook detached sig 5 minutes (replay)

All constants live in @bdi/contracts so the wire profile is single-source.

# Key management

Each service carries:

Rotation is a scheduled job (in the reference, a cron BullMQ job; in development, called manually). When the active key rotates, the event asr.keys.rotated is published so consumers refresh their trustlists.

# Signer adapters

The reference JwsSigner is backed by HMAC-SHA-256 via WebCrypto. It conforms to the RawSigner port so production deployments plug in:

All adapters implement the same two methods:

interface RawSigner {
  sign(payload: Uint8Array): Promise<Uint8Array>;
  verify(payload: Uint8Array, signature: Uint8Array): Promise<boolean>;
}

# Certificate authority (ACME)

For the production implementation @bdi/crypto-ca provides an RFC 8555 server skeleton with:

Operators plug in the actual CA via CertificateAuthority port: a bundled step-ca adapter, a PKCS#11/HSM adapter, or their own.

# Threat model (summary)

Threat Mitigation
Stolen connector private key Cert revocation → trustlist update → BVAD fails next issuance; short BVAD lifetime bounds window
Replayed BVAD jti + 30s clock skew; BVAD-only, not for data-plane
Replayed webhook Bdi-Event-Id seen-cache (7-day TTL) in CON
Malicious subscription endpoint Callback-URL whitelist via ASR registration
Compromised ASR DB Tokens carry hashes, not PII; trustlist is signed
Wrong issuer impersonation BVAD iss pinned to association root JWK in CON

# Reporting

If you discover a security issue, do not file a public issue. Email security@connekt.nl with:

We'll acknowledge within 3 business days and aim to disclose & fix within 30 days.