1ZIP_FILE_SET_ENCRYPTI... BSD Library Functions Manual ZIP_FILE_SET_ENCRYPTI...
2

NAME

4     zip_file_set_encryption — set encryption method for file in zip
5

LIBRARY

7     libzip (-lzip)
8

SYNOPSIS

10     #include <zip.h>
11
12     int
13     zip_file_set_encryption(zip_t *archive, zip_uint64_t index,
14         zip_uint16_t method, const char *password);
15

DESCRIPTION

17     The zip_file_set_encryption() function sets the encryption method for the
18     file at position index in the zip archive to method using the password
19     password.  The method is the same as returned by zip_stat(3).  For the
20     method argument, currently only the following values are supported:
21
22     ZIP_EM_NONE        No encryption.
23
24     ZIP_EM_AES_128     Winzip AES-128 encryption.
25
26     ZIP_EM_AES_192     Winzip AES-192 encryption.
27
28     ZIP_EM_AES_256     Winzip AES-256 encryption.
29
30     If password is NULL, the default password provided by
31     zip_set_default_password(3) is used.
32
33     The current encryption method for a file in a zip archive can be deter‐
34     mined using zip_stat(3).
35

RETURN VALUES

37     Upon successful completion 0 is returned.  Otherwise, -1 is returned and
38     the error information in archive is set to indicate the error.
39

ERRORS

41     zip_file_set_encryption() fails if:
42
43     [ZIP_ER_ENCRNOTSUPP]
44                        Unsupported compression method requested.
45
46     [ZIP_ER_INVAL]     index is not a valid file index in archive, or the
47                        argument combination is invalid.
48
49     [ZIP_ER_MEMORY]    Required memory could not be allocated.
50
51     [ZIP_ER_RDONLY]    Read-only zip file, no changes allowed.
52

SEE ALSO

54     libzip(3), zip_set_default_password(3), zip_stat(3)
55

HISTORY

57     zip_file_set_encryption() was added in libzip 1.2.0.
58

AUTHORS

60     Dieter Baron <dillo@nih.at> and Thomas Klausner <tk@giga.or.at>
61
62BSD                            December 18, 2017                           BSD
Impressum