Skip to content

Certificates

huzpsb edited this page Oct 25, 2026 · 1 revision

Certificates

Manage the trusted certificate store used for signature validation. Standard builds start with an empty trusted directory — import what you trust. Builds created with -tags pdfcpu_eutl initialize with an embedded snapshot of EU Trusted List bundles.

Command line

pdfcpu2 certificates list                 # installed trusted certificates
pdfcpu2 certificates list --json
pdfcpu2 certificates import ca.pem        # .pem, .p7c, .cer, .crt
pdfcpu2 certificates inspect ca.pem       # detailed dump
pdfcpu2 certificates reset                # wipe back to empty (or EUTL snapshot)

Go API

package main

import (
	"context"
	"fmt"

	"github.com/huzpsb/pdfcpu2/pkg/api"
)

func main() {
	ss, err := api.ListCertificates(context.Background(), false)
	if err != nil {
		panic(err)
	}
	for _, s := range ss {
		fmt.Println(s)
	}

	ss, err = api.ImportCertificates(context.Background(), []string{"ca.pem"})
	_ = ss
	_ = err

	ss, err = api.InspectCertificates(context.Background(), []string{"ca.pem"})
	_ = ss
	_ = err
}

The certificate store lives in the configuration directory — see Configuration. Used by Signatures validation.

Clone this wiki locally