Module: EncryptedZip

Defined in:
lib/encryptedzip.rb,
lib/encryptedzip/version.rb

Constant Summary collapse

VERSION =
"0.0.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.encrypted_filepath=(value) ⇒ Object

Sets the attribute encrypted_filepath

Parameters:

  • value

    the value to set the attribute encrypted_filepath to.



9
10
11
# File 'lib/encryptedzip.rb', line 9

def encrypted_filepath=(value)
  @encrypted_filepath = value
end

.password_path=(value) ⇒ Object

Sets the attribute password_path

Parameters:

  • value

    the value to set the attribute password_path to.



9
10
11
# File 'lib/encryptedzip.rb', line 9

def password_path=(value)
  @password_path = value
end

.public_key_fileObject

Returns the value of attribute public_key_file.



9
10
11
# File 'lib/encryptedzip.rb', line 9

def public_key_file
  @public_key_file
end

Class Method Details

.create_encrypted_zip(options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/encryptedzip.rb', line 12

def self.create_encrypted_zip(options={})
  check_errors(options)
  password = generate_password
  create_password_file(password)

  create_zip(encrypted_filepath, options[:files])
  Zip::Archive.encrypt(encrypted_filepath, password)

  create_zip(options[:output_filepath], 
    [password_path, encrypted_filepath])

  clean_up
  options[:output_filepath]
end