envelope

package
v0.1.23 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 2 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 envelope says what protects an encrypted package: the compound file that an encrypted Office document is stored in ([MS-OFFCRYPTO]), and that an XPS document under rights management is stored in too. It is one test for go-fast-ooxml, go-fast-pdf and go-fast-msbin, and one wording of what each library says of a package it does not open.

Nothing is decrypted here. A library that decrypts (go-fast-ooxml, with a password or a private key) does so after Detect says Password.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Message

func Message(p Protection, subject string) string

Message says what a package that is not opened is, for the text of an error; subject names it: "Office document", "package". It is "" for None.

Types

type Protection

type Protection int

Protection is what an envelope says protects the package in it.

const (
	// None: the compound file is no envelope.
	None Protection = iota
	// RightsManaged: rights management (Information Rights Management).
	// The key is in a licence that a rights-management server issues to
	// the people the document names ([MS-OFFCRYPTO] 2.2.11, 2.6).
	RightsManaged
	// Password: the EncryptionInfo and EncryptedPackage streams of an
	// encrypted Office document. The key is made from a password, or held
	// for the owners of certificates ([MS-OFFCRYPTO] 2.3).
	Password
	// Unstated: an envelope (a \x06DataSpaces storage or an
	// EncryptedPackage stream) that is neither of the others.
	Unstated
)

func Detect

func Detect(f *cfb.File) Protection

Detect says what protects the package f holds. Rights management is known by the streams Office writes (\x09DRMEncryptedDataSpace, \x09DRMEncryptedTransform, \x09DRMContent) and by those the .NET packaging classes write around an XPS document, which name the transform as they like and keep each user's licence beside it, in a stream whose name begins "EUL-".

Jump to

Keyboard shortcuts

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