cms

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cms builds CMS (PKCS #7) SignedData for PDF signatures: detached signatures over a PDF's byte ranges, as /adbe.pkcs7.detached and /ETSI.CAdES.detached expect, and encapsulated ones for tests.

Index

Constants

This section is empty.

Variables

View Source
var (

	// OIDTSTInfo is the content type of an RFC 3161 timestamp token.
	OIDTSTInfo = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 16, 1, 4}
)

Functions

func Certificates

func Certificates(der []byte) []*x509.Certificate

Certificates are the certificates in a degenerate SignedData (a .p7c bundle), or nil.

func Sign

func Sign(o Options) ([]byte, error)

Sign builds the ContentInfo holding the SignedData, DER encoded.

func SignerCertificate

func SignerCertificate(der []byte) *x509.Certificate

SignerCertificate is the signer's certificate in a CMS SignedData, or nil when it can't be found. The signature isn't verified.

Types

type Options

type Options struct {
	// Digest is the hash of the signed content (for a PDF, its byte
	// ranges), made with Hash. Ignored when Content is set.
	Digest []byte
	Hash   crypto.Hash // SHA256, SHA384 or SHA512
	// Content, when set, is encapsulated in the signature with the
	// content type ContentType (data when nil).
	Content     []byte
	ContentType asn1.ObjectIdentifier

	Signer crypto.Signer
	Chain  []*x509.Certificate // the signer's certificate first

	// SigningTime, when not zero, is added as a signed attribute.
	SigningTime time.Time
	// SigningCertificate adds the ESS signing-certificate-v2 attribute,
	// which CAdES requires.
	SigningCertificate bool
	// OCSP and CRLs, DER encoded, go in Adobe's revocation archive
	// attribute, so the signature validates later and offline.
	OCSP, CRLs [][]byte
	// Timestamp, when set, gets the signature value and gives back an
	// RFC 3161 timestamp token for it, added as an unsigned attribute.
	Timestamp func(signature []byte) ([]byte, error)
}

Options describe one signature.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL