security

package
v3.0.0-...-55e877b Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2023 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventDocOpen = AuthEvent("\u0044o\u0063\u004f\u0070\u0065\u006e")
	EventEFOpen  = AuthEvent("\u0045\u0046\u004f\u0070\u0065\u006e")
)
View Source
const (
	PermOwner             = Permissions(_bga.MaxUint32)
	PermPrinting          = Permissions(1 << 2)
	PermModify            = Permissions(1 << 3)
	PermExtractGraphics   = Permissions(1 << 4)
	PermAnnotate          = Permissions(1 << 5)
	PermFillForms         = Permissions(1 << 8)
	PermDisabilityExtract = Permissions(1 << 9)
	PermRotateInsert      = Permissions(1 << 10)
	PermFullPrintQuality  = Permissions(1 << 11)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthEvent

type AuthEvent string

AuthEvent is an event type that triggers authentication.

type Permissions

type Permissions uint32

Permissions is a bitmask of access permissions for a PDF file.

func (Permissions) Allowed

func (_ad Permissions) Allowed(p2 Permissions) bool

Allowed checks if a set of permissions can be granted.

type StdEncryptDict

type StdEncryptDict struct {
	R               int
	P               Permissions
	EncryptMetadata bool
	O, U            []byte
	OE, UE          []byte
	Perms           []byte
}

StdEncryptDict is a set of additional fields used in standard encryption dictionary.

type StdHandler

type StdHandler interface {

	// GenerateParams uses owner and user passwords to set encryption parameters and generate an encryption key.
	// It assumes that R, P and EncryptMetadata are already set.
	GenerateParams(_bff *StdEncryptDict, _cd, _ca []byte) ([]byte, error)

	// Authenticate uses encryption dictionary parameters and the password to calculate
	// the document encryption key. It also returns permissions that should be granted to a user.
	// In case of failed authentication, it returns empty key and zero permissions with no error.
	Authenticate(_dfg *StdEncryptDict, _gc []byte) ([]byte, Permissions, error)
}

StdHandler is an interface for standard security handlers.

func NewHandlerR4

func NewHandlerR4(id0 string, length int) StdHandler

NewHandlerR4 creates a new standard security handler for R<=4.

func NewHandlerR6

func NewHandlerR6() StdHandler

NewHandlerR6 creates a new standard security handler for R=5 and R=6.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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