Skip to content

Certificates

huzpsb edited this page Nov 8, 2026 · 2 revisions

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

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

Go API

package main

import (
	"context"
	"fmt"

	"github.com/huzpsb/hspdf/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