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

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

Overview

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

Defined Under Namespace

Classes: Base, Decrypt, Encrypt

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.


366
367
368
# File 'lib/archive/zip/codec/traditional_encryption.rb', line 366

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::Decrypt object using that class' open method.


384
385
386
# File 'lib/archive/zip/codec/traditional_encryption.rb', line 384

def decryptor(io, password, &b)
  Decrypt.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::Encrypt object using that class' open method.


374
375
376
# File 'lib/archive/zip/codec/traditional_encryption.rb', line 374

def encryptor(io, password, &b)
  Encrypt.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.


402
403
404
# File 'lib/archive/zip/codec/traditional_encryption.rb', line 402

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.


410
411
412
# File 'lib/archive/zip/codec/traditional_encryption.rb', line 410

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.


393
394
395
# File 'lib/archive/zip/codec/traditional_encryption.rb', line 393

def version_needed_to_extract
  0x0014
end