Class: CryptoToolchain::DiffieHellman::Messages::Datum
- Defined in:
- lib/crypto_toolchain/diffie_hellman/messages.rb
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
-
#initial ⇒ Object
(also: #initial?)
readonly
Returns the value of attribute initial.
-
#peer ⇒ Object
readonly
Returns the value of attribute peer.
Instance Method Summary collapse
- #decrypt(key:) ⇒ Object
-
#initialize(peer:, contents:, initial: false) ⇒ Datum
constructor
A new instance of Datum.
Constructor Details
#initialize(peer:, contents:, initial: false) ⇒ Datum
Returns a new instance of Datum.
37 38 39 40 41 |
# File 'lib/crypto_toolchain/diffie_hellman/messages.rb', line 37 def initialize(peer: , contents: , initial: false) @peer = peer @contents = contents @initial = initial end |
Instance Attribute Details
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
48 49 50 |
# File 'lib/crypto_toolchain/diffie_hellman/messages.rb', line 48 def contents @contents end |
#initial ⇒ Object (readonly) Also known as: initial?
Returns the value of attribute initial.
48 49 50 |
# File 'lib/crypto_toolchain/diffie_hellman/messages.rb', line 48 def initial @initial end |
#peer ⇒ Object (readonly)
Returns the value of attribute peer.
48 49 50 |
# File 'lib/crypto_toolchain/diffie_hellman/messages.rb', line 48 def peer @peer end |
Instance Method Details
#decrypt(key:) ⇒ Object
43 44 45 46 |
# File 'lib/crypto_toolchain/diffie_hellman/messages.rb', line 43 def decrypt(key: ) iv = contents[0..15] contents[16..-1].decrypt_cbc(key: key, iv: iv) end |