Class: Archive::Zip::Codec::TraditionalEncryption

Inherits:
Object
  • Object
show all
Defined in:
lib/archive/zip/codec/traditional_encryption.rb,
lib/archive/zip/codec/traditional_encryption/base.rb,
lib/archive/zip/codec/traditional_encryption/reader.rb,
lib/archive/zip/codec/traditional_encryption/writer.rb

Overview

Archive::Zip::Codec::TraditionalEncryption is a handle for the traditional encryption codec.

Defined Under Namespace

Classes: Base, Reader, Writer

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#mtimeObject

The last modified time of the entry to be processed. Set this before calling #encryptor or #decryptor.



12
13
14
# File 'lib/archive/zip/codec/traditional_encryption.rb', line 12

def mtime
  @mtime
end

Instance Method Details

#decryptor(io, password, &b) ⇒ Object

This method signature is part of the interface contract expected by Archive::Zip::Entry for encryption codec objects.

A convenience method for creating an Archive::Zip::Codec::TraditionalEncryption::Reader object using that class’ open method.



30
31
32
# File 'lib/archive/zip/codec/traditional_encryption.rb', line 30

def decryptor(io, password, &b)
  Reader.open(io, password, mtime, &b)
end

#encryptor(io, password, &b) ⇒ Object

This method signature is part of the interface contract expected by Archive::Zip::Entry for encryption codec objects.

A convenience method for creating an Archive::Zip::Codec::TraditionalEncryption::Writer object using that class’ open method.



20
21
22
# File 'lib/archive/zip/codec/traditional_encryption.rb', line 20

def encryptor(io, password, &b)
  Writer.open(io, password, mtime, &b)
end

#general_purpose_flagsObject

This method signature is part of the interface contract expected by Archive::Zip::Entry for encryption codec objects.

Returns an integer representing the general purpose flags of a ZIP archive entry using this encryption codec.



48
49
50
# File 'lib/archive/zip/codec/traditional_encryption.rb', line 48

def general_purpose_flags
  0b0000000000000001
end

#header_sizeObject

This method signature is part of the interface contract expected by Archive::Zip::Entry for encryption codec objects.

Returns the size of the encryption header in bytes.



56
57
58
# File 'lib/archive/zip/codec/traditional_encryption.rb', line 56

def header_size
  12
end

#version_needed_to_extractObject

This method signature is part of the interface contract expected by Archive::Zip::Entry for encryption codec objects.

Returns an integer which indicates the version of the official ZIP specification which introduced support for this encryption codec.



39
40
41
# File 'lib/archive/zip/codec/traditional_encryption.rb', line 39

def version_needed_to_extract
  0x0014
end