Skip to content

Commit

Permalink
ZIP AES (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
fcharlie committed Jul 22, 2023
1 parent 1fc58a0 commit 735a933
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/archive/zip/aes.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "zipinternal.hpp"


// File format
// |Size (bytes)|Content|
// |------------|-----------|
// |Variable |Salt value|
// |2 |Password verification value|
// |Variable | Encrypted file data|
// |10 |Authentication code|
// Key ----
// Key size Salt size
// 128 bits 8 bytes
// 192 bits 12 bytes
// 256 bits 16 bytes
7 changes: 7 additions & 0 deletions lib/archive/zip/zip.cc
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,13 @@ bool readDirectoryHeader(bufioReader &br, Buffer &buffer, File &file, bela::erro
continue;
}
// https://www.winzip.com/win/en/aes_info.html
// Offset Size(bytes) Content
// 0 2 Extra field header ID (0x9901)
// 2 2 Data size (currently 7, but subject to possible increase in the future)
// 4 2 Integer version number specific to the zip vendor
// 6 2 2-character vendor ID
// 8 1 Integer mode value indicating AES encryption strength
// 9 2 The actual compression method used to compress the file
if (fieldTag == winzipAesExtraID) {
if (fb.Size() < 7) {
continue;
Expand Down

0 comments on commit 735a933

Please sign in to comment.