Skip to content

Add support for reading ZIP files utilising AES encryption #179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Correct some bad merging, to figure out the compression method when g…
…etting a decompressor
  • Loading branch information
muz committed Aug 29, 2014
commit 207a3a9b5b6d8b57cab1dca85bfa7499d1016d04
15 changes: 8 additions & 7 deletions lib/zip/input_stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,16 @@ def open_entry
@current_entry
end

def get_decompressor
case
when @current_entry.nil?
def get_decompressor(compression_method = nil)
compression_method ||= @current_entry.compression_method unless @current_entry.nil?
case compression_method
when nil
::Zip::NullDecompressor
when @current_entry.compression_method == ::Zip::Entry::STORED
when ::Zip::Entry::STORED
::Zip::PassThruDecompressor.new(@archive_io, @current_entry.size)
when @current_entry.compression_method == ::Zip::Entry::DEFLATED
when ::Zip::Entry::DEFLATED
::Zip::Inflater.new(@archive_io)
when @current_entry.compression_method == ::Zip::Entry::ENCRYPTED
when ::Zip::Entry::ENCRYPTED
if @current_entry.extra["AES"].vendor_id != "AE"
raise ZipCompressionMethodError, "The #{@current_entry.extra["AES"].vendor_id} encryption method is not supported"
end
Expand All @@ -160,7 +161,7 @@ def get_decompressor

else
raise ::Zip::CompressionMethodError,
"Unsupported compression method #{@current_entry.compression_method}"
"Unsupported compression method #{compression_method}"
end
end

Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy