Versions in this module Expand all Collapse all v0 v0.3.0 Oct 30, 2026 Changes in this version + var DefaultContentDecryptionAlgorithms = []ContentEncryptionAlgorithm + var ErrAttributeNotFound = errors.New("pkcs7: attribute type not in attributes") + var ErrContentEncryptionNotAllowed = errors.New("pkcs7: content encryption algorithm is not allowed") + var ErrDecryptionFailed = errors.New("pkcs7: decryption failed") + var ErrNotEncryptedContent = errors.New("pkcs7: content data is not an encrypted data type") + var ErrPSKNotProvided = errors.New("pkcs7: cannot encrypt content: PSK not provided") + var ErrUnsupportedAlgorithm = errors.New(...) + var ErrUnsupportedAsymmetricEncryptionAlgorithm = errors.New("pkcs7: cannot decrypt data: only RSA PKCS#1 v1.5 and RSA OAEP are supported") + var ErrUnsupportedContentType = errors.New("pkcs7: cannot parse data: unimplemented content type") + var ErrUnsupportedEncryptionAlgorithm = errors.New(...) + var ErrUnsupportedKeyEncryptionAlgorithm = errors.New("pkcs7: unsupported key encryption algorithm provided") + var ErrUnsupportedKeyEncryptionHash = errors.New("pkcs7: unsupported key encryption hash provided") + var ErrUnsupportedKeyType = errors.New("pkcs7: only RSA keys are supported") + var OIDAttributeContentType = asn1.ObjectIdentifier + var OIDAttributeMessageDigest = asn1.ObjectIdentifier + var OIDAttributeSigningTime = asn1.ObjectIdentifier + var OIDData = asn1.ObjectIdentifier + var OIDDigestAlgorithmECDSASHA1 = asn1.ObjectIdentifier + var OIDDigestAlgorithmECDSASHA256 = asn1.ObjectIdentifier + var OIDDigestAlgorithmECDSASHA384 = asn1.ObjectIdentifier + var OIDDigestAlgorithmECDSASHA512 = asn1.ObjectIdentifier + var OIDDigestAlgorithmMD5 = asn1.ObjectIdentifier + var OIDDigestAlgorithmSHA1 = asn1.ObjectIdentifier + var OIDDigestAlgorithmSHA224 = asn1.ObjectIdentifier + var OIDDigestAlgorithmSHA256 = asn1.ObjectIdentifier + var OIDDigestAlgorithmSHA384 = asn1.ObjectIdentifier + var OIDDigestAlgorithmSHA512 = asn1.ObjectIdentifier + var OIDEncryptedData = asn1.ObjectIdentifier + var OIDEncryptionAlgorithmAES128CBC = asn1.ObjectIdentifier + var OIDEncryptionAlgorithmAES192CBC = asn1.ObjectIdentifier + var OIDEncryptionAlgorithmAES256CBC = asn1.ObjectIdentifier + var OIDEncryptionAlgorithmDESCBC = asn1.ObjectIdentifier + var OIDEncryptionAlgorithmDESEDE3CBC = asn1.ObjectIdentifier + var OIDEncryptionAlgorithmECDSAP256 = asn1.ObjectIdentifier + var OIDEncryptionAlgorithmECDSAP384 = asn1.ObjectIdentifier + var OIDEncryptionAlgorithmECDSAP521 = asn1.ObjectIdentifier + var OIDEncryptionAlgorithmRSA = asn1.ObjectIdentifier + var OIDEncryptionAlgorithmRSAESOAEP = asn1.ObjectIdentifier + var OIDEncryptionAlgorithmRSAMD5 = asn1.ObjectIdentifier + var OIDEncryptionAlgorithmRSASHA1 = asn1.ObjectIdentifier + var OIDEncryptionAlgorithmRSASHA224 = asn1.ObjectIdentifier + var OIDEncryptionAlgorithmRSASHA256 = asn1.ObjectIdentifier + var OIDEncryptionAlgorithmRSASHA384 = asn1.ObjectIdentifier + var OIDEncryptionAlgorithmRSASHA512 = asn1.ObjectIdentifier + var OIDEncryptionAlgorithmRSASSAPSS = asn1.ObjectIdentifier + var OIDEnvelopedData = asn1.ObjectIdentifier + var OIDMaskGenerationFunctionMGF1 = asn1.ObjectIdentifier + var OIDOAEPSourcePSpecified = asn1.ObjectIdentifier + var OIDSignedData = asn1.ObjectIdentifier + func DegenerateCRL(crl []byte) ([]byte, error) + func DegenerateCertificate(cert []byte) ([]byte, error) + func Encrypt(content []byte, recipients []*x509.Certificate, opts EncryptOptions) ([]byte, error) + func EncryptUsingPSK(content []byte, key []byte, opts EncryptOptions) ([]byte, error) + type Attribute struct + Type asn1.ObjectIdentifier + Value any + type ContentEncryptionAlgorithm int + const AES128CBC + const AES192CBC + const AES256CBC + const DESCBC + const DESEDE3CBC + func (a ContentEncryptionAlgorithm) String() string + type DecryptOptions struct + ContentEncryptionAlgorithms []ContentEncryptionAlgorithm + type EncryptOptions struct + ContentEncryption ContentEncryptionAlgorithm + KeyEncryption KeyEncryptionAlgorithm + OAEPHash crypto.Hash + type Hasher interface + Hash func(crypto.Hash, io.Reader) ([]byte, error) + type KeyEncryptionAlgorithm int + const RSAOAEP + const RSAPKCS1v15 + func (a KeyEncryptionAlgorithm) String() string + type MessageDigestMismatchError struct + ActualDigest []byte + ExpectedDigest []byte + func (err *MessageDigestMismatchError) Error() string + type PKCS7 struct + CRLs []pkix.CertificateList + Certificates []*x509.Certificate + Content []byte + Hasher Hasher + Signers []signerInfo + func Parse(data []byte) (*PKCS7, error) + func ParseWithOptions(data []byte, opts ParseOptions) (*PKCS7, error) + func (p7 *PKCS7) ContentEncryptionAlgorithm() (ContentEncryptionAlgorithm, error) + func (p7 *PKCS7) Decrypt(cert *x509.Certificate, key crypto.Decrypter, opts DecryptOptions) ([]byte, error) + func (p7 *PKCS7) DecryptUsingPSK(key []byte, opts DecryptOptions) ([]byte, error) + func (p7 *PKCS7) GetOnlySigner() *x509.Certificate + func (p7 *PKCS7) Recipients() ([]Recipient, error) + func (p7 *PKCS7) UnmarshalSignedAttribute(attributeType asn1.ObjectIdentifier, out any) error + func (p7 *PKCS7) Verify(opts VerifyOptions) error + type ParseOptions struct + LegacyCertificateParser bool + type Recipient struct + Issuer []byte + SerialNumber *big.Int + type SignedData struct + func NewSignedData(data []byte) (*SignedData, error) + func (sd *SignedData) AddCertificate(cert *x509.Certificate) + func (sd *SignedData) AddSigner(ee *x509.Certificate, key crypto.Signer, config SignerInfoConfig) error + func (sd *SignedData) AddSignerChain(ee *x509.Certificate, key crypto.Signer, parents []*x509.Certificate, ...) error + func (sd *SignedData) Detach() + func (sd *SignedData) Finish() ([]byte, error) + func (sd *SignedData) GetSignedData() *signedData + func (sd *SignedData) RemoveAuthenticatedAttributes() + func (sd *SignedData) RemoveCertificates() + func (sd *SignedData) RemoveUnauthenticatedAttributes() + func (sd *SignedData) SetDigestAlgorithm(d asn1.ObjectIdentifier) + func (sd *SignedData) SetEncryptionAlgorithm(d asn1.ObjectIdentifier) + func (sd *SignedData) SignWithoutAttr(ee *x509.Certificate, key crypto.Signer, _ SignerInfoConfig) error + type SignerInfoConfig struct + ExtraSignedAttributes []Attribute + ExtraUnsignedAttributes []Attribute + SigningTime time.Time + type SigningTimeNotValidError struct + NotAfter time.Time + NotBefore time.Time + SigningTime time.Time + func (e *SigningTimeNotValidError) Error() string + type VerifyOptions struct + AllowMD5 bool + CurrentTime time.Time + Intermediates []*x509.Certificate + KeyUsages []x509.ExtKeyUsage + Roots *x509.CertPool + SignerCertificates []*x509.Certificate + VerifyAtSigningTime bool