logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

zip_fopen_encrypted, zip_fopen_index_encrypted — open encrypted file in zip archive for reading

Authors

       Dieter Baron <dillo@nih.at> and Thomas Klausner <wiz@gatalith.at>

Caveats

       The  zip  file  format  provides  very  limited possibility for password verification (a short hash of is
       compared against one byte in the zip archive).  For this reason, reading a file while using an  incorrect
       password  may immediately fail with ZIP_ER_WRONGPASSWD, but if the mismatch is not detected, a zlib error
       may be returned later instead.  Since zlib errors can also be caused by broken compressed data, there  is
       no  way  to  make  sure  if  the password was incorrect or if it was correct, but the compressed data was
       invalid.

Debian                                         September 15, 2020                         ZIP_FOPEN_ENCRYPTED(3)

Description

       The  zip_fopen_encrypted()  function  opens  the  encrypted file name fname in archive using the password
       given in the password argument.  If password is NULL or the empty string, the default  password  is  used
       (see zip_set_default_password(3)).  The flags argument are the same as for zip_fopen(3).

       The zip_fopen_index_encrypted() function opens the file at position index, see zip_fopen_index(3).  These
       functions  are  called automatically by zip_fopen(3); you only need to call them if you want to specify a
       non-default password (see zip_set_default_password(3)).

Errors

       [ZIP_ER_NOPASSWD]     No password was provided.

       The  function zip_fopen_encrypted() may also fail and set zip_err for any of the errors specified for the
       routine zip_fopen(3).

       The function zip_fopen_index_encrypted() may also fail and set zip_err for any of  the  errors  specified
       for the routine zip_fopen_index(3).

History

zip_fopen_encrypted() and zip_fopen_index_encrypted() were added in libzip 1.0.

Library

       libzip (-lzip)

Name

       zip_fopen_encrypted, zip_fopen_index_encrypted — open encrypted file in zip archive for reading

Return Values

       Upon successful completion, a structzip_file pointer is returned.  Otherwise, NULL is returned  and  the
       error code in archive is set to indicate the error.

See Also

libzip(3), zip_fclose(3), zip_fopen(3), zip_fread(3), zip_get_num_entries(3), zip_name_locate(3)

Synopsis

#include<zip.h>zip_file_t*zip_fopen_encrypted(zip_t*archive, constchar*fname, zip_flags_tflags, constchar*password);

       zip_file_t*zip_fopen_index_encrypted(zip_t*archive, zip_uint64_tindex, zip_flags_tflags, constchar*password);

See Also