Class: Yasst::Profiles::OpenSSL

Inherits:
Yasst::Profile show all
Includes:
Yasst::Primatives::OpenSSL::Metadata
Defined in:
lib/yasst/profiles/openssl.rb

Overview

OpenSSL Profile

Constant Summary collapse

DEFAULT_SALT_BYTES =
8
DEFAULT_KEY_GEN_METHOD =
:pbkdf2
DEFAULT_PBKDF2_ITERATIONS =
50_000
DEFAULT_ALGORITHM =
'AES-256-CBC'.freeze
SUPPORTED_KEY_GEN_METHODS =
[:pbkdf2].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Yasst::Primatives::OpenSSL::Metadata

iv_len_for, key_len_for, list_ciphers

Constructor Details

#initialize(**args) ⇒ OpenSSL

Returns a new instance of OpenSSL.



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/yasst/profiles/openssl.rb', line 20

def initialize(**args)
  args[:algorithm].nil? && (self.algorithm = DEFAULT_ALGORITHM) ||
    (self.algorithm = args[:algorithm])
  args[:salt_bytes].nil? && (@salt_bytes = DEFAULT_SALT_BYTES) ||
    (self.salt_bytes = args[:salt_bytes])
  args[:key_gen_method].nil? &&
    (self.key_gen_method = DEFAULT_KEY_GEN_METHOD) ||
    (self.key_gen_method = args[:key_gen_method])
  args[:pbkdf2_iterations].nil? &&
    (self.pbkdf2_iterations = DEFAULT_PBKDF2_ITERATIONS) ||
    (self.pbkdf2_iterations = args[:pbkdf2_iterations])
end

Instance Attribute Details

#algorithmObject

Returns the value of attribute algorithm.



8
9
10
# File 'lib/yasst/profiles/openssl.rb', line 8

def algorithm
  @algorithm
end

#iv_lenObject (readonly)

Returns the value of attribute iv_len.



8
9
10
# File 'lib/yasst/profiles/openssl.rb', line 8

def iv_len
  @iv_len
end

#key_gen_methodObject

Returns the value of attribute key_gen_method.



8
9
10
# File 'lib/yasst/profiles/openssl.rb', line 8

def key_gen_method
  @key_gen_method
end

#key_lenObject (readonly)

Returns the value of attribute key_len.



8
9
10
# File 'lib/yasst/profiles/openssl.rb', line 8

def key_len
  @key_len
end

#pbkdf2_iterationsObject

Returns the value of attribute pbkdf2_iterations.



8
9
10
# File 'lib/yasst/profiles/openssl.rb', line 8

def pbkdf2_iterations
  @pbkdf2_iterations
end

#salt_bytesObject

Returns the value of attribute salt_bytes.



10
11
12
# File 'lib/yasst/profiles/openssl.rb', line 10

def salt_bytes
  @salt_bytes
end

Instance Method Details

#file_extensionObject

files matching this are deemed to be already encrypted by default TODO: auto file extension based on the algorithm in use



36
37
38
# File 'lib/yasst/profiles/openssl.rb', line 36

def file_extension
  'aes'
end