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.



371
372
373
# File 'lib/archive/zip/codec/traditional_encryption.rb', line 371

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.



389
390
391
# File 'lib/archive/zip/codec/traditional_encryption.rb', line 389

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.



379
380
381
# File 'lib/archive/zip/codec/traditional_encryption.rb', line 379

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.



407
408
409
# File 'lib/archive/zip/codec/traditional_encryption.rb', line 407

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.



415
416
417
# File 'lib/archive/zip/codec/traditional_encryption.rb', line 415

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.



398
399
400
# File 'lib/archive/zip/codec/traditional_encryption.rb', line 398

def version_needed_to_extract
  0x0014
end