mirror of https://github.com/yeka/zip.git
Export SetEncryptionMethod.
Allows creation of own header. For example UTF-8 file names by setting bit 11 on header.
This commit is contained in:
parent
c5fb195ee3
commit
790e8f4b4e
|
@ -437,7 +437,8 @@ func (h *FileHeader) writeWinZipExtra() {
|
|||
h.Extra = append(h.Extra, buf[:]...)
|
||||
}
|
||||
|
||||
func (h *FileHeader) setEncryptionMethod(enc EncryptionMethod) {
|
||||
// SetEncryptionMethod sets the encryption method.
|
||||
func (h *FileHeader) SetEncryptionMethod(enc EncryptionMethod) {
|
||||
h.encryption = enc
|
||||
switch enc {
|
||||
case AES128Encryption:
|
||||
|
@ -478,6 +479,6 @@ func (w *Writer) Encrypt(name string, password string, enc EncryptionMethod) (io
|
|||
Method: Deflate,
|
||||
}
|
||||
fh.SetPassword(password)
|
||||
fh.setEncryptionMethod(enc)
|
||||
fh.SetEncryptionMethod(enc)
|
||||
return w.CreateHeader(fh)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue