smime

package
v0.0.0-...-d6da04a Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package smime unwraps opaque S/MIME messages (application/pkcs7-mime). Graph delivers such mail as an empty body plus one smime.p7m attachment; for signedData the actual message sits inside the CMS structure and can be extracted client-side (without verifying the signature). envelopedData is genuinely encrypted and cannot be read via the API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPKCS7Attachment

func IsPKCS7Attachment(name, contentType string) bool

IsPKCS7Attachment reports whether an attachment looks like an opaque S/MIME container.

Types

type Part

type Part struct {
	Name        string
	ContentType string
	Data        []byte
}

Part is a file extracted from the inner MIME message.

type Result

type Result struct {
	Encrypted bool   // envelopedData: content not readable via API
	Body      string // extracted body text (plain preferred, HTML fallback)
	Parts     []Part // inner attachments
}

Result of unwrapping a pkcs7-mime blob.

func Unwrap

func Unwrap(blob []byte) (*Result, error)

Unwrap parses a CMS blob. Encrypted content is reported, signed content is unwrapped into body text and inner attachments. The signature is NOT verified - callers must present the result as unverified.

Jump to

Keyboard shortcuts

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