Certenov0.16.0

Online Revocation Checking

A developer guide for integrating online CRL and OCSP certificate revocation checking into your Certeno-powered application.

@trexolab/certeno-plugin-revocation


What is Certificate Revocation?

Digital certificates can be revoked before they expire. Common reasons include:

  • The certificate's private key was compromised.
  • The certificate was issued in error.
  • The organization that owns the certificate has ceased operations.
  • The certificate holder violated the CA's policies.

Once a certificate is revoked, any signatures made with it after the revocation date should not be trusted. There are two standard mechanisms for checking revocation:

CRL (Certificate Revocation List) — The CA publishes a signed list of all revoked certificate serial numbers. Clients download the full list and check whether the certificate's serial number appears in it. CRLs can be large (megabytes) and are typically updated on a schedule (hourly to daily).

OCSP (Online Certificate Status Protocol) — The client sends a small request containing the certificate's serial number to the CA's OCSP responder, which replies with the current status (good, revoked, or unknown). OCSP provides real-time status with minimal bandwidth.

Why you need online checking: Many signatures carry no revocation data at all, and those that do (for LTV/long-term validation) carry what was true on the day of signing. Online checking asks the CA for the status of every certificate the document leaves unanswered.

Who decides what the answer means: the engine, not the plugin. The plugin downloads a CRL or OCSP response and hands the bytes over untouched. The engine then checks that the CA (or a responder it authorised) actually signed it, that it is about the certificate in question, and that it covers the moment the signature is being judged at — the same checks it applies to revocation data embedded in the document. A response that fails any of them is ignored. See How It Works Internally.


Quick Start

React + Next.js (most common)

1. Install packages:

bash
echo '@trexolab:registry=https://certeno.trexolab.com/api/registry' > .npmrc
npm install @trexolab/certeno-react @trexolab/certeno-plugin-revocation

2. Create the server handler:

ts
// app/api/revocation/route.ts
import { handleRevocation } from '@trexolab/certeno-plugin-revocation/handler'
 
export const POST = handleRevocation()

3. Add the plugin to your provider:

tsx
// app/viewer/page.tsx
'use client'
 
import { useState } from 'react'
import {
  CertenoProvider,
  Viewer,
  WelcomeScreen,
  useVerification,
  defaultLayoutPlugin,
} from '@trexolab/certeno-react'
import { revocationPlugin } from '@trexolab/certeno-plugin-revocation'
import '@trexolab/certeno-react/styles.css'
 
const config = {
  workerUrl: 'https://unpkg.com/pdfjs-dist@5.5.207/legacy/build/pdf.worker.min.mjs',
  plugins: [revocationPlugin({ endpoint: '/api/revocation' })],
  theme: { mode: 'system' as const },
}
 
export default function ViewerPage() {
  return (
    <CertenoProvider config={config}>
      <PdfViewer />
    </CertenoProvider>
  )
}
 
function PdfViewer() {
  const verification = useVerification()
  const [layout] = useState(() => defaultLayoutPlugin())
 
  if (!verification.fileBuffer) {
    return <WelcomeScreen onOpenFile={(f) => verification.load(f)} />
  }
 
  return (
    <Viewer
      fileBuffer={verification.fileBuffer}
      fileName={verification.fileName}
      plugins={[layout.plugin]}
      onOpenFile={(f) => verification.load(f)}
      signatures={verification.signatures}
      verificationStatus={verification.status ?? undefined}
    />
  )
}

That's it. When a user opens a signed PDF, the plugin automatically checks each signer's certificate against live CRL/OCSP endpoints. Results appear in the signature panel and properties dialog.


React + Vite + Express

1. Install packages:

bash
echo '@trexolab:registry=https://certeno.trexolab.com/api/registry' > .npmrc
npm install @trexolab/certeno-react @trexolab/certeno-plugin-revocation
npm install express @trexolab/certeno-plugin-revocation

2. Create Express server with handler:

ts
// server.ts
import express from 'express'
import { expressHandler } from '@trexolab/certeno-plugin-revocation/handler/express'
 
const app = express()
app.use(express.json())
app.post('/api/revocation', expressHandler())
 
app.listen(3001, () => {
  console.log('Revocation API running on port 3001')
})

3. Configure Vite proxy:

ts
// vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
 
export default defineConfig({
  plugins: [react()],
  server: {
    proxy: {
      '/api/revocation': 'http://localhost:3001',
    },
  },
})

4. Add the plugin to your React app:

tsx
import { CertenoProvider } from '@trexolab/certeno-react'
import { revocationPlugin } from '@trexolab/certeno-plugin-revocation'
 
const config = {
  workerUrl: 'https://unpkg.com/pdfjs-dist@5.5.207/legacy/build/pdf.worker.min.mjs',
  plugins: [revocationPlugin({ endpoint: '/api/revocation' })],
}
 
function App() {
  return (
    <CertenoProvider config={config}>
      {/* your viewer component */}
    </CertenoProvider>
  )
}

React + Hono

1. Create Hono server:

ts
// server.ts
import { Hono } from 'hono'
import { serve } from '@hono/node-server'
import { handleRevocation } from '@trexolab/certeno-plugin-revocation/handler'
 
const app = new Hono()
const handler = handleRevocation()
 
app.post('/api/revocation', (c) => handler(c.req.raw))
 
serve({ fetch: app.fetch, port: 3001 })

2. Add the plugin to your React app:

tsx
import { CertenoProvider } from '@trexolab/certeno-react'
import { revocationPlugin } from '@trexolab/certeno-plugin-revocation'
 
const config = {
  workerUrl: 'https://unpkg.com/pdfjs-dist@5.5.207/legacy/build/pdf.worker.min.mjs',
  plugins: [revocationPlugin({ endpoint: '/api/revocation' })],
}
 
function App() {
  return (
    <CertenoProvider config={config}>
      {/* your viewer component */}
    </CertenoProvider>
  )
}

Node.js (Headless)

No server needed. The plugin fetches CRL/OCSP endpoints directly.

ts
import { createVerifier } from '@trexolab/certeno-core'
import { revocationPlugin } from '@trexolab/certeno-plugin-revocation'
import { readFile } from 'node:fs/promises'
 
async function verifyWithRevocation(filePath: string) {
  const verifier = await createVerifier({
    plugins: [revocationPlugin()],  // no endpoint = direct mode
  })
 
  try {
    const buffer = await readFile(filePath)
    const result = await verifier.verify(buffer, filePath)
 
    for (const sig of result.signatures) {
      console.log(`Signer: ${sig.name}`)
      console.log(`  Overall: ${sig.overallStatus}`)
      console.log(`  Revocation: ${sig.revocationCheck.status} — ${sig.revocationCheck.detail}`)
    }
 
    return result
  } finally {
    verifier.dispose()
  }
}
 
await verifyWithRevocation('signed-document.pdf')

Vanilla JS

html
<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" href="https://certeno.trexolab.com/cdn/certeno.css">
</head>
<body>
  <div id="viewer" style="width: 100%; height: 100vh;"></div>
 
  <script src="https://certeno.trexolab.com/cdn/certeno.umd.js"></script>
  <script>
    var viewer = Certeno.create(document.getElementById('viewer'), {
      workerUrl: 'https://unpkg.com/pdfjs-dist@5.5.207/legacy/build/pdf.worker.min.mjs',
      plugins: [/* revocationPlugin must be configured in your bundled setup */],
    })
  </script>
</body>
</html>

For the vanilla UMD bundle, revocation plugin configuration is passed as part of the Certeno.create() options. A server handler must be mounted at /api/revocation for proxy-mode revocation to work (see the server setup examples above).


Configuration

Basic (defaults)

All defaults: OCSP enabled, CRL enabled, 10-second timeout, 10 MB max CRL size.

ts
revocationPlugin({ endpoint: '/api/revocation' })

Custom Timeout

ts
revocationPlugin({ endpoint: '/api/revocation', timeout: 20000 })

Disable OCSP (CRL only)

Useful if you know your CAs do not run OCSP responders, or if you want to avoid OCSP's potential privacy implications.

ts
revocationPlugin({ endpoint: '/api/revocation', ocsp: false })

Disable CRL (OCSP only)

Useful when CRL files are too large and you only want real-time OCSP checks.

ts
revocationPlugin({ endpoint: '/api/revocation', crl: false })

Custom Headers (authentication)

Static headers:

ts
revocationPlugin({
  endpoint: '/api/revocation',
  headers: { 'Authorization': 'Bearer my-static-token' },
})

Dynamic headers (re-evaluated on each request):

ts
revocationPlugin({
  endpoint: '/api/revocation',
  headers: () => ({ 'Authorization': `Bearer ${getToken()}` }),
})

Error Callback

ts
revocationPlugin({
  endpoint: '/api/revocation',
  onError: (err, ctx) => {
    console.warn(`Revocation ${ctx.type} failed for ${ctx.url}:`, err.message)
    // ctx.type is 'crl' or 'ocsp'
    // ctx.url is the endpoint URL
  },
})

Direct Mode with All Options

ts
revocationPlugin({
  // no endpoint = direct mode
  timeout: 15000,
  maxCrlSize: 5 * 1024 * 1024,  // 5 MB
  ocsp: true,
  crl: true,
})

Server Handler Configuration

Basic

ts
export const POST = handleRevocation()

Custom Timeout

ts
export const POST = handleRevocation({ timeout: 15000 })

Custom URL Filter (SSRF protection)

ts
export const POST = handleRevocation({
  urlFilter: (url) => {
    try {
      const u = new URL(url)
      return u.hostname.startsWith('crl.') ||
             u.hostname.startsWith('ocsp.') ||
             u.hostname.endsWith('.digicert.com') ||
             u.hostname.endsWith('.globalsign.com')
    } catch {
      return false
    }
  },
})

Custom CRL Size Limit

ts
export const POST = handleRevocation({ maxCrlSize: 5 * 1024 * 1024 }) // 5 MB

All Options Combined

ts
export const POST = handleRevocation({
  timeout: 15000,
  maxCrlSize: 5 * 1024 * 1024,
  urlFilter: (url) => {
    try {
      const u = new URL(url)
      return u.protocol === 'http:' || u.protocol === 'https:'
    } catch {
      return false
    }
  },
})

Architecture

┌─────────────────────────────────────────────────────────────────────┐
│  Browser                                                            │
│                                                                     │
│  ┌──────────────────────┐  1. verify → chain entries the document   │
│  │ @trexolab/certeno-   │     leaves 'unknown', each with the URLs  │
│  │ core  (Rust / WASM)  │     to ask and an OCSP request to send    │
│  └──────────┬───────────┘                                           │
│             │                    ▲                                  │
│             ▼                    │ 4. verify again, with the bytes: │
│  ┌──────────────────────┐        │    signature, subject and dates  │
│  │ @trexolab/certeno-   │        │    are checked here              │
│  │ plugin-revocation    │────────┘                                  │
│  │                      │                                           │
│  │ revocationPlugin({   │  2. POST /api/revocation                  │
│  │   endpoint: '/api/   │     { kind: 'ocsp', url: 'http://ocsp…',  │
│  │   revocation'        │       body: '<base64 request>' }          │
│  │ })                   │──────────────────────────┐                │
│  └──────────────────────┘                          │                │
│             ▲                                      │                │
├─────────────┼──────────────────────────────────────┼────────────────┤
│  Server     │ 3. the response body, as received    ▼                │
│             │    (application/octet-stream)                         │
│  ┌──────────┴──────────────────────────────────────────────┐        │
│  │ handleRevocation() / expressHandler() / processRevocation│        │
│  │                                                         │        │
│  │  a. Validate the request                                │        │
│  │  b. Apply the SSRF URL filter                           │        │
│  │  c. GET the CRL, or POST the OCSP request ──────────────┼───┐    │
│  │  d. Return the bytes — it does not read them            │   │    │
│  └─────────────────────────────────────────────────────────┘   │    │
│                                                                │    │
├────────────────────────────────────────────────────────────────┼────┤
│  External CA Infrastructure                                    ▼    │
│                                                                     │
│  ┌──────────────┐  ┌──────────────┐                                 │
│  │ CRL Endpoint │  │ OCSP         │                                 │
│  │ (HTTP GET)   │  │ Responder    │                                 │
│  │              │  │ (HTTP POST)  │                                 │
│  └──────────────┘  └──────────────┘                                 │
└─────────────────────────────────────────────────────────────────────┘

The server is a relay. It exists because a browser cannot reach most CA endpoints (they send no CORS headers, and many are plain HTTP), not because it knows anything about certificates. That is also why a compromised or mistaken relay cannot make a signature look better than it is: whatever it returns still has to carry the CA's signature to count.

In Node.js direct mode (no endpoint), the plugin skips the server and makes the downloads from the same process.


How It Works Internally

What Gets Asked About

Every certificate in the signer's chain, up to the trust anchor — not only the signer's. A certificate authority that was revoked cannot vouch for the certificates it issued.

After verification, each entry of sig.certificateChain carries a revocationStatus: what the document's own CRLs and OCSP responses establish about it. Entries that read 'unknown' are the ones to ask about. A document that already answers for every certificate (an LTV-enabled one, typically) causes no network requests at all.

Check Priority

For each unanswered certificate:

  1. OCSP first — one small request about that one certificate. The engine builds the request (cert.ocspRequest); the plugin POSTs it to the certificate's OCSP URL.
  2. CRL as the fallback — if the certificate has no OCSP responder, the responder does not answer, or its answer does not hold up, the CRL is downloaded from the certificate's distribution point.
  3. No CRL for an expired certificate. A CA removes a certificate from its CRL once it expires, so a CRL downloaded today cannot clear it; only its OCSP responder is asked.
  4. Each distinct download is made once per verification, however many signatures share the certificate.

What the Engine Checks

The downloaded bytes are passed back into the engine, which runs the verification again with them. A CRL or OCSP response — downloaded or embedded — counts only if all of these hold:

CheckWhy
A CRL is signed by the CA that issued the certificateThe issuer name on a CRL is just text. Without the signature, anyone can produce an empty CRL bearing a CA's name.
An OCSP response is signed by that CA, or by a responder with the OCSPSigning extended key usage issued within the certificate's chainSame, for OCSP. Responses are usually fetched over plain HTTP.
An OCSP response's issuerKeyHash identifies the issuing CASerial numbers are unique per CA, not globally.
A "not revoked" answer covers the moment the certificate is judged atIt must not have lapsed (nextUpdate) by then, and must have been issued while the certificate was still valid — CAs drop expired certificates from their CRLs, so a later CRL says nothing about one.

A statement that a certificate was revoked needs only the signature: it counts whatever its age.

How the Result Is Reached

The data sayssig.revocationCheck.statussig.overallStatus
Signer not revoked, no CA above it revoked'valid'Unchanged
Signer, or a CA above it, revoked before the signing time'invalid''invalid'
Revoked after the signing time, and a trusted timestamp proves when the document was signed'valid'UnchangedThe signature predates the revocation.
Revoked after the claimed signing time, with no timestamp'invalid''invalid'Nothing proves the signature was made first.
No usable answer about the signer'unknown'Unchanged

A CA the data says nothing about does not fail the check; its chain entry keeps revocationStatus: 'unknown'.

Online data settles a certificate's revocation status and nothing else. It does not back a claimed signing time (see Which Moment a Signature Is Judged At) and does not make a signature LTV-enabled — both are about what the document carries.

The attempted Field

When the signer's certificate was asked about online and is still unanswered, revocationCheck.attempted is true. This distinguishes between:

  • Not attempted (attempted is undefined): No plugin is installed, or there was nothing to ask (no URLs in the certificate). The document's own data left the status unknown.
  • Attempted (attempted: true): The plugin tried. Every endpoint failed, or what came back did not hold up.

Adobe Reader Parity

This distinction matters for getDisplayStatus() (Adobe Reader parity):

  • Offline / not attempted: Adobe Reader shows the signature as valid when revocation was never checked. The display status does not downgrade to "unknown."
  • Online / attempted but failed: Adobe Reader shows "unknown" when an active revocation check was inconclusive. The display status is downgraded to "unknown."

In summary: offline = valid, online + failed = unknown. This matches Adobe Reader DC behavior.


Without vs With Revocation

What the viewer shows in each scenario:

Without the Plugin

FieldValue
Revocation bullet in SignatureListPanel"Revocation status unknown" (gray question mark)
Revocation row in Properties dialog"Certificate revocation status is unknown."
LTV status"Signature is LTV enabled." only if the document itself carries revocation data for the whole chain
sig.revocationCheck.status'unknown', unless the document carries its own revocation data
sig.revocationCheck.detail'No embedded revocation data (CRL/OCSP) found in this signature or DSS. …'

With the Plugin (certificate is good)

FieldValue
Revocation bullet in SignatureListPanel"Certificate is not revoked" (green checkmark)
Revocation row in Properties dialog"Certificate is not revoked — verified via online OCSP." or "… via online CRL."
LTV statusUnchanged. LTV is about what the document itself carries; an online answer does not make a signature LTV-enabled.
sig.revocationCheck.status'valid'
sig.revocationCheck.detail'Certificate is not revoked — verified via online OCSP.'
sig.certificateChain[i].revocationStatus'good' for each certificate that was answered for

With the Plugin (certificate is revoked)

FieldValue
DocumentMessageBar"At least one signature is INVALID." (red background)
Revocation bullet in SignatureListPanel"Certificate has been revoked" (red X)
Identity row in Properties dialog"Signer's identity is invalid because the certificate has been revoked."
sig.revocationCheck.status'invalid'
sig.overallStatus'invalid'

The same applies when a certificate authority above the signer is revoked: revocationCheck.detail names the CA, and its chain entry reads revocationStatus: 'revoked'.


Troubleshooting

CORS errors in browser

Symptom: Browser console shows CORS errors when verifying a signed PDF.

Cause: The plugin in proxy mode sends requests to your server, not directly to CRL/OCSP endpoints. If the handler is not mounted on the same origin as your app, or CORS is not configured, requests will fail.

Fix: Mount the server handler on the same origin as your frontend (e.g., /api/revocation in Next.js). If cross-origin is unavoidable, add CORS headers on the server:

ts
// Next.js example with CORS
import { handleRevocation } from '@trexolab/certeno-plugin-revocation/handler'
 
const handler = handleRevocation()
 
export async function POST(req: Request) {
  const res = await handler(req)
  res.headers.set('Access-Control-Allow-Origin', 'https://your-app.com')
  return res
}

Building an Electron, Tauri, or browser-extension viewer? You can skip the proxy server entirely — see Desktop & Extension Viewers.

Revocation check still says "Not checked (offline)"

Cause: The plugin was imported but not passed to createVerifier() or CertenoProvider.

Fix: Pass the plugin in the plugins array:

ts
// Headless
const verifier = await createVerifier({
  plugins: [revocationPlugin()],  // must be in this array
})
 
// React
<CertenoProvider config={{
  workerUrl: 'https://unpkg.com/pdfjs-dist@5.5.207/legacy/build/pdf.worker.min.mjs',
  plugins: [revocationPlugin({ endpoint: '/api/revocation' })],
}}>

A certificate stays unknown after an online check

Look at the chain entry — sig.certificateChain[i] — for the certificate in question.

  • It has no ocspUrls and no crlDistributionPoints. There is nowhere to ask. Some certificates (self-signed, internal CAs) carry neither extension.
  • It has no ocspRequest. The engine builds the OCSP request from the issuer's name and key, so it needs the issuer's certificate. If the chain is incomplete, OCSP is skipped and only the CRL is tried — and a CRL cannot be authenticated without the issuer either. Fix the chain first (embedded certificates, the trust store, or AIA fetching).
  • The download failed. The responder is down or rate-limiting, the CRL server is unreachable from your server (curl <crl-url> from that machine), or the body is larger than maxCrlSize. onError fires for network failures.
    ts
    handleRevocation({ maxCrlSize: 20 * 1024 * 1024 }) // 20 MB
  • The download succeeded but did not hold up. The response was not signed by the certificate's CA (or an authorised responder), is about a different certificate, had already lapsed, or was issued after the certificate expired. The engine ignores it rather than guess. See What the Engine Checks.
  • The certificate has expired. A CA stops listing a certificate once it expires, so a CRL fetched today says nothing about it. Only revocation data from when it was valid — embedded in the document — can answer for an expired certificate.
  • Both CRL and OCSP are disabled. Check that you have not set both crl: false and ocsp: false.

Server returns 400

Cause: The request body is not the JSON the handler expects — { kind: 'crl', url } or { kind: 'ocsp', url, body }.

Fix (Express): Ensure express.json() middleware is applied before the handler route:

ts
app.use(express.json())                           // must come first
app.post('/api/revocation', expressHandler())      // then the handler

Fix (other frameworks): Ensure the request body is parsed as JSON before reaching the handler.

A 400 right after an upgrade means the browser bundle and the server are on different versions of the plugin: the two sides of the proxy are one package and must be deployed together.

Server returns 403

Symptom: The handler answers 403 { "error": "refused" } and the certificate stays unknown.

Cause: The SSRF filter rejected the URL. The default filter refuses loopback and private-network addresses (localhost, 127.0.0.1, 10.*, 192.168.*, 172.16–31.*, *.local, *.internal) and anything that is not http: or https:.

Fix: If your CA's endpoints really are on a private network, say so explicitly with urlFilter:

ts
handleRevocation({
  urlFilter: (url) => new URL(url).hostname === 'pki.corp.internal',
})

Server returns 502

The handler could not get a usable body from the CA: a non-2xx status, a timeout, an empty response, or one larger than maxCrlSize. The plugin treats this as "no answer from this source" and the engine moves on to the next one.

"fetch is not defined" (Node.js < 18)

Cause: The plugin uses the global fetch() API, which requires Node.js 18+.

Fix: Upgrade to Node.js 20.19.0+ (recommended). Alternatively, install a fetch polyfill like undici.

Timeout errors

Symptom: Certificates consistently stay 'unknown' and onError fires with abort errors.

Cause: CRL/OCSP endpoints are slow to respond, or the default 10-second timeout is too short.

Fix: Increase the timeout on both client and server:

ts
// Client
revocationPlugin({ endpoint: '/api/revocation', timeout: 30000 })
 
// Server
handleRevocation({ timeout: 30000 })

Combining with Custom Trust Store

The revocation plugin works alongside custom trust store configuration:

ts
const verifier = await createVerifier({
  trustStore: {
    certificates: [enterpriseRootPem],
    mode: 'merge',
  },
  plugins: [revocationPlugin({ endpoint: '/api/revocation' })],
})

Revocation checking runs after trust chain validation. If a certificate chains to your custom trust store root, the plugin will still check its revocation status against the CA's live endpoints.


Dependencies

  • @trexolab/certeno-core — provides the CertenoPlugin interface and the RevocationFetchRequest type, and is what judges everything the plugin downloads. Required as a peer dependency.
  • No external runtime dependencies. The plugin uses the native fetch() API (available in Node.js 18+ and all modern browsers).

Further Reading

  • API Reference — complete API documentation for every function, type, and option
  • Examples — additional integration examples
  • Architecture — how the Certeno SDK is structured