crypto

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package crypto contains PDF encryption code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptDeepObject

func DecryptDeepObject(objIn types.PDFObject, objNr, genNr int, key []byte, aes bool) (*types.PDFStringLiteral, error)

DecryptDeepObject recurses over non trivial PDF objects and decrypts all strings encountered.

func DecryptStream

func DecryptStream(needAES bool, buf []byte, objNr, genNr int, key []byte) ([]byte, error)

DecryptStream decrypts a stream buffer using RC4 or AES.

func DecryptString

func DecryptString(needAES bool, s string, objNr, genNr int, key []byte) (*string, error)

DecryptString decrypts s using RC4 or AES.

func EncryptDeepObject

func EncryptDeepObject(objIn types.PDFObject, objNr, genNr int, key []byte, aes bool) (*types.PDFStringLiteral, error)

EncryptDeepObject recurses over non trivial PDF objects and encrypts all strings encountered.

func EncryptStream

func EncryptStream(needAES bool, buf []byte, objNr, genNr int, key []byte) ([]byte, error)

EncryptStream encrypts a stream buffer using RC4 or AES.

func EncryptString

func EncryptString(needAES bool, s string, objNr, genNr int, key []byte) (*string, error)

EncryptString encrypts s using RC4 or AES.

func HasNeededPermissions

func HasNeededPermissions(mode types.CommandMode, enc *types.Enc) bool

HasNeededPermissions returns true if permissions for pdfcpu processing are present.

func ID added in v0.1.1

func ID(ctx *types.PDFContext) *types.PDFArray

ID generates the ID element for this file.

func ListPermissions added in v0.1.6

func ListPermissions(ctx *types.PDFContext) (list []string)

ListPermissions returns the list of user access permissions.

func NewEncryptDict added in v0.1.5

func NewEncryptDict(needAES, need128BitKey bool, permissions int16) *types.PDFDict

NewEncryptDict creates a new EncryptDict using the standard security handler.

func O added in v0.1.1

func O(ctx *types.PDFContext) ([]byte, error)

O calculates the owner password digest.

func SupportedCFEntry

func SupportedCFEntry(d *types.PDFDict) (bool, error)

SupportedCFEntry returns true if all entries found are supported.

func SupportedEncryption

func SupportedEncryption(ctx *types.PDFContext, dict *types.PDFDict) (*types.Enc, error)

SupportedEncryption returns true if used encryption is supported by pdfcpu Also returns a pointer to a struct encapsulating used encryption.

func U added in v0.1.1

func U(ctx *types.PDFContext) (u []byte, key []byte, err error)

U calculates the user password digest.

func ValidateOwnerPassword

func ValidateOwnerPassword(ctx *types.PDFContext) (ok bool, k []byte, err error)

ValidateOwnerPassword validates the owner password aka change permissions password.

func ValidateUserPassword

func ValidateUserPassword(ctx *types.PDFContext) (ok bool, key []byte, err error)

ValidateUserPassword validates the user password aka document open password.

Types

This section is empty.

Jump to

Keyboard shortcuts

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