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 ¶
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 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.