crypto

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2017 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package crypto provides PDF encryption plumbing code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptDeepObject

func DecryptDeepObject(objIn interface{}, 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 interface{}, 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(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 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, bool)

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.

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, err error)

ValidateOwnerPassword validates ownerpw.

func ValidateUserPassword

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

ValidateUserPassword validates userpw.

func Verbose

func Verbose(verbose bool)

Verbose controls logging output.

Types

This section is empty.

Jump to

Keyboard shortcuts

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