Class: CryptReboot::Luks::Data

Inherits:
Object
  • Object
show all
Defined in:
lib/crypt_reboot/luks/data.rb

Overview

Value-object with encryption parameters

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cipherObject (readonly)

Returns the value of attribute cipher.



7
8
9
# File 'lib/crypt_reboot/luks/data.rb', line 7

def cipher
  @cipher
end

#keyObject (readonly)

Returns the value of attribute key.



7
8
9
# File 'lib/crypt_reboot/luks/data.rb', line 7

def key
  @key
end

#offsetObject (readonly)

Returns the value of attribute offset.



7
8
9
# File 'lib/crypt_reboot/luks/data.rb', line 7

def offset
  @offset
end

#sector_sizeObject (readonly)

Returns the value of attribute sector_size.



7
8
9
# File 'lib/crypt_reboot/luks/data.rb', line 7

def sector_size
  @sector_size
end

Instance Method Details

#==(other) ⇒ Object



9
10
11
12
# File 'lib/crypt_reboot/luks/data.rb', line 9

def ==(other)
  cipher == other.cipher && offset == other.offset &&
    sector_size == other.sector_size && key == other.key
end

#key_bitsObject



14
15
16
# File 'lib/crypt_reboot/luks/data.rb', line 14

def key_bits
  key.bytesize * 8
end

#with_key(new_key) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/crypt_reboot/luks/data.rb', line 18

def with_key(new_key)
  self.class.new(
    cipher: cipher,
    offset: offset,
    sector_size: sector_size,
    key: new_key
  )
end