# X.509

> Read subjects, expiry and fingerprints from certificates, fetch TLS chains, and find every logged certificate for a domain

This page includes setup, release pins, credentials, hosting and verification evidence. [JSON alternative](https://query.farm/products/orchard/api/v1/connectors/x509.json) contains the same setup facts for structured readers; choose one format.

## Runtime and release

Use DuckDB or Haybarn **2.0.1** with **VGI protocol 3.4**.
Catalog alias: `x509`. Release: [v0.6.0](https://github.com/Query-farm/vgi-x509/releases/tag/v0.6.0). Metadata generated: 2026-12-01T18:22:16+00:00.

## Choose where it runs

- On your machine: use an installation method below. No Query Farm account is required for local execution.
- Self-host: follow [the connector deployment instructions](https://github.com/Query-farm/vgi-x509) and [connection guide](https://query.farm/vgi/connect-to-a-worker/). Use your real endpoint and its authentication settings.
- Query Farm hosted: [create a deployment](https://auth.queryfarm.cloud/console/new?worker=x509). Hosting has a $10 monthly minimum per organization; usage and license fees may apply. Copy the deployment-specific ATTACH from the console.

## Service credentials and prerequisites

No service credentials are declared by this connector. Individual datasets, input files or deployments may have their own prerequisites.

Secret parameter required flags describe the upstream declaration; they do not override the service-level mode above. Keep secrets in environment variables or the deployment secret store. SQL values in angle brackets are placeholders, not automatic environment lookups. Native DuckDB and Haybarn 2.0.1 do not provide a SQL getenv() function, even when worker-supplied snippets mention it. Read environment variables in your application and pass credential values through client parameter bindings (for example, Python con.execute("CREATE SECRET stripe (TYPE stripe, api_key ?)", [os.environ["STRIPE_API_KEY"]]) after attaching the connector. Omit unused optional parameters and keep real values out of saved SQL and logs.

## Install the extension

In stock DuckDB:

```sql
SET allow_extension_repositories = 'allowed';

CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
    WITH PREFIX 'https://duckdb-extensions.query.farm';

INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
```

In Haybarn:

```sql
INSTALL vgi FROM community;
LOAD vgi;
```

## Attach the connector

The local recipes below pin the catalog release for repeatability. A public demo endpoint follows its deployed release.

### From GitHub

Attach the release directly

Uses the verified release each time you attach the connector.

```sql
ATTACH 'x509' AS x509 (
  TYPE vgi,
  LOCATION 'github-auto://Query-farm/vgi-x509@v0.6.0'
);
```

### Docker

Attach the signed image

Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.

```sql
ATTACH 'x509' AS x509 (
  TYPE vgi,
  LOCATION 'oci://ghcr.io/query-farm/vgi-x509:0.6.0'
);
```

## Dump every certificate attribute as (field, value) rows, ordered by field.

Service credentials required for this example: not declared by this example; check the connector requirements above.

```sql
SELECT field, value FROM x509.main.cert_info('-----BEGIN CERTIFICATE-----
MIIB3DCCAYGgAwIBAgIEOt5osTAKBggqhkjOPQQDAjA7MRkwFwYDVQQKExBWR0kg
WDUwOSBGaXh0dXJlMR4wHAYDVQQDExV0ZXN0LnZnaS14NTA5LmV4YW1wbGUwHhcN
MjUwMTAxMDAwMDAwWhcNMzUwMTAxMDAwMDAwWjA7MRkwFwYDVQQKExBWR0kgWDUw
OSBGaXh0dXJlMR4wHAYDVQQDExV0ZXN0LnZnaS14NTA5LmV4YW1wbGUwWTATBgcq
hkjOPQIBBggqhkjOPQMBBwNCAAS7Zbq+Bz73Y0wKrZZkw4owgz7qyAtXYUrNUkac
Ot2h1WpF/Y+ODgRoeo0+ixbqPxA8+Lm9DTpksjsxTMRni/Owo3MwcTAOBgNVHQ8B
Af8EBAMCAoQwEwYDVR0lBAwwCgYIKwYBBQUHAwEwDAYDVR0TAQH/BAIwADA8BgNV
HREENTAzghV0ZXN0LnZnaS14NTA5LmV4YW1wbGWCFGFsdC52Z2kteDUwOS5leGFt
cGxlhwR/AAABMAoGCCqGSM49BAMCA0kAMEYCIQCGCty4v7uWVHE/HhanzxE2kzBo
KBiJ1j25vqPbFP4x7AIhAPdzfBNzgiIxriWsiBH1HBtoOCRsMJ6WN+j7zxyn9Np0
-----END CERTIFICATE-----') ORDER BY field
```

- [x509.main.cert_info — table_function](https://query.farm/products/orchard/connectors/x509/objects/table_function.bWFpbg.Y2VydF9pbmZv.md): exact declaration for this example.

Execution evidence: **captured_result**.

```json
{
  "status": "captured_result",
  "capturedAt": "2026-12-01T06:24:17+00:00",
  "engineVersion": "2.0.1",
  "protocolVersion": "3.4.0",
  "releaseTag": "v0.6.0",
  "sample": {
    "columns": [
      "field",
      "value"
    ],
    "types": [
      "VARCHAR",
      "VARCHAR"
    ],
    "rows": [
      [
        "fingerprint_sha256",
        "9e35a0b16a0912d01fc75093fd8ab5500f0a425e6b91110c0054f66bb7df5b16"
      ],
      [
        "is_ca",
        "false"
      ],
      [
        "is_expired",
        "false"
      ],
      [
        "issuer",
        "CN=test.vgi-x509.example,O=VGI X509 Fixture"
      ],
      [
        "key_algorithm",
        "ECDSA-P256"
      ]
    ],
    "more": true
  }
}
```

## Connector reference

### X.509 Certificate & TLS Inspection for DuckDB

**Parse X.509 certificates and inspect live TLS endpoints directly in SQL** — read subjects, issuers, validity windows, SHA-256 fingerprints, and subject alternative names (SANs) from PEM or DER certificates, and pull the certificate chain a TLS server presents, all without leaving DuckDB.

This is a defensive security and compliance toolkit for anyone who works with certificates at scale: SREs auditing certificate expiry across a fleet, security engineers triaging TLS configurations, and compliance teams reporting on certificate authorities, key algorithms, and signature algorithms. Certificate Transparency search adds the outside view: every certificate a public CA has logged for your domains, including ones you did not know were issued. Instead of shelling out to `openssl` and parsing text by hand, you query certificates and endpoints as ordinary SQL columns and rows, then filter, join, and aggregate them like any other DuckDB data.

It is powered entirely by the Go standard library's battle-tested [`crypto/x509`](https://pkg.go.dev/crypto/x509) and [`crypto/tls`](https://pkg.go.dev/crypto/tls) packages — no third-party parsing code. The only external service is the free, keyless [crt.sh](https://crt.sh/) index of the public Certificate Transparency logs, used only for Certificate Transparency search. The worker speaks the VGI protocol over Arrow, so DuckDB attaches it as a catalog and certificate parsing runs in-process at native speed. Certificate inputs are accepted as **PEM text** (`VARCHAR`) or **DER bytes** (`BLOB`); the format is sniffed from the content at runtime, so one query works for both.

## When to reach for it

Reach for this worker whenever certificates or TLS endpoints show up in your data and you want to treat them as structured columns rather than opaque blobs: auditing expiry windows across a fleet, pinning or comparing SHA-256 fingerprints, checking key and signature algorithms against a policy, expanding a certificate into a row per attribute for ad-hoc inspection, or pulling the chain a live server presents to confirm what it actually serves. Offline certificate parsing runs entirely in-process; live endpoint inspection **opens a network connection, so use it against AUTHORIZED endpoints only.**

## Typical uses

A few patterns recur. To flag soon-to-expire certificates, apply `cert_not_after` to a column of PEM or DER certificates and keep the rows whose expiry falls inside your renewal window, reporting each certificate's `cert_subject` alongside. To audit cryptographic hygiene across a fleet, group a certificate table by `cert_key_algorithm` and `cert_signature_algorithm` and count the weak ones. To confirm what a server actually serves, call the `tls_inspect` table function on an **authorized** `host:port` and read back the presented chain. To find every certificate issued for your domain, search the public Certificate Transparency logs with a `'%.example.com'` pattern (a passive lookup via crt.sh that never contacts your hosts) and download the logged certificates for the parsing scalars. Browse the `cert_fields` registry view to discover every attribute the worker can read and the scalar that returns each; ready-to-run, fully qualified statements live in the `x509.main` schema's example queries.

Learn more about the underlying library in the [Go `crypto/x509` documentation](https://pkg.go.dev/crypto/x509) and the [Go source on GitHub](https://github.com/golang/go/tree/master/src/crypto/x509). Source for this worker lives at [github.com/Query-farm/vgi-x509](https://github.com/Query-farm/vgi-x509).

## Find the exact SQL object

[Browse 16 object declarations](https://query.farm/products/orchard/api/v1/connectors/x509/objects.json) or [search within this connector](https://query.farm/products/orchard/api/v1/search.json?kind=object&connector=x509&q=x509).

Follow one format of each needed object for complete argument types, defaults, named flags, return columns and examples. Existing links above can replace another search. For questions about hosting, credentials or supported operations, stop once the documentation answers the question; SQL and unrelated object lookups are unnecessary.

## Verification and interpretation

- Missing, null, or undeclared metadata means unknown; do not invent defaults, credential scope, platform support or endpoint URLs.
- Search is keyword retrieval, not proof of a capability. Read the exact object declaration before generating SQL.
- A table and a table function can have the same name. Preserve parentheses and use the matching overload and schema.
- Service credentials, external data availability and deployment authentication are separate requirements.
- Catalog verification records the harvest environment. It is not proof that every query or current live API call succeeds. Only an example with captured_result has a saved result for that exact SQL.

```json
{
  "generatedAt": "2026-12-01T18:22:16+00:00",
  "repository": "https://github.com/Query-farm/vgi-x509",
  "harvest": {
    "status": "ok",
    "method": "github-auto",
    "error": null,
    "vgi_version": "9773130dde"
  },
  "catalogVerification": {
    "verified": true,
    "status": "passed",
    "total": 12,
    "passed": 12,
    "failed": 0,
    "needs_credentials": 0,
    "location": "github-auto://Query-farm/vgi-x509@v0.6.0",
    "transport": "github-auto",
    "environment": {
      "vgi_extension_version": "9773130dde",
      "haybarn_version": "2.0.1rc3",
      "engine_version": "v2.0.1",
      "python": "3.12.4",
      "platform": "darwin_arm64",
      "protocol_version": "3.4.0"
    },
    "checked_at": "2026-12-01T06:22:09+00:00"
  },
  "interpretation": "Catalog verification records the harvest environment. It is not proof that every query or current live API call succeeds. Only an example with captured_result has a saved result for that exact SQL."
}
```
