Class: Archive::Zip::Codec::NullEncryption

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

Overview

Archive::Zip::Codec::NullEncryption is a handle for an encryption codec which passes data through itself unchanged.

Instance Method Summary collapse

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



26
27
28
29
# File 'lib/archive/zip/codec/null_encryption.rb', line 26

def decryptor(io, password, &b)
  return io unless block_given?
  b[io]
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::NullEncryption::Encrypt object using that class’ open method.



15
16
17
18
# File 'lib/archive/zip/codec/null_encryption.rb', line 15

def encryptor(io, password, &b)
  return io unless block_given?
  b[io]
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.



45
46
47
# File 'lib/archive/zip/codec/null_encryption.rb', line 45

def general_purpose_flags
  0b0000000000000000
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.



53
54
55
# File 'lib/archive/zip/codec/null_encryption.rb', line 53

def header_size
  0
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.



36
37
38
# File 'lib/archive/zip/codec/null_encryption.rb', line 36

def version_needed_to_extract
  0x0014
end