Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidPassword = errors.New("invalid password") ErrNotEncrypted = errors.New("not encrypted with zipcrypto") )
var ( ErrInvalidHeader = errors.New("invalid header") ErrEncryptionFlagNotSet = fmt.Errorf("%w: encryption flag not set", ErrInvalidHeader) )
Functions ¶
func NewReader ¶
NewReader creates a reader that validates the given password and decrypts data as it is read.
The password is validated against the zip.FileHeader provided
func NewWriter ¶
NewWriter uses a properly configured zip.FileHeader and password to create a writer that encrypts as data is written to it.
Note: due to this implementation being external to archive/zip, the zip.FileHeader must be filled out (including the Flags, CRC32, and the CompressedSize64 must be set 12 bytes longer than the actual value).
This is because (zip.Writer).CreateRaw creates the writer that must be wrapped by this function and the zip.FileHeader cannot be modified once CreateRaw has been called.
Types ¶
This section is empty.