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     ZIP_EM_TRAD_PKWARE
31                        Traditional PKWare encryption.  Do not use this
32                        method, it is not secure.  It is only provided for
33                        backwards compatibility.
34
35     If password is NULL, the default password provided by
36     zip_set_default_password(3) is used.
37
38     The current encryption method for a file in a zip archive can be deter‐
39     mined using zip_stat(3).
40

RETURN VALUES

42     Upon successful completion 0 is returned.  Otherwise, -1 is returned and
43     the error information in archive is set to indicate the error.
44

ERRORS

46     zip_file_set_encryption() fails if:
47
48     [ZIP_ER_ENCRNOTSUPP]
49                        Unsupported compression method requested.
50
51     [ZIP_ER_INVAL]     index is not a valid file index in archive, or the ar‐
52                        gument combination is invalid.
53
54     [ZIP_ER_MEMORY]    Required memory could not be allocated.
55
56     [ZIP_ER_RDONLY]    Read-only zip file, no changes allowed.
57

SEE ALSO

59     libzip(3), zip_encryption_method_supported(3), zip_fopen_encrypted(3),
60     zip_fopen_index_encrypted(3), zip_set_default_password(3), zip_stat(3)
61

HISTORY

63     zip_file_set_encryption() was added in libzip 1.2.0.
64

AUTHORS

66     Dieter Baron <dillo@nih.at> and Thomas Klausner <tk@giga.or.at>
67
68BSD                              April 2, 2020                             BSD
Impressum