Class: Linzer::HMAC::Key

Inherits:
Key
  • Object
show all
Defined in:
lib/linzer/hmac.rb

Instance Attribute Summary

Attributes inherited from Key

#material

Instance Method Summary collapse

Methods inherited from Key

#initialize, #key_id

Constructor Details

This class inherits a constructor from Linzer::Key

Instance Method Details

#sign(data) ⇒ Object



11
12
13
# File 'lib/linzer/hmac.rb', line 11

def sign(data)
  OpenSSL::HMAC.digest(@params[:digest], material, data)
end

#validateObject



6
7
8
9
# File 'lib/linzer/hmac.rb', line 6

def validate
  super
  validate_digest
end

#verify(signature, data) ⇒ Object



15
16
17
# File 'lib/linzer/hmac.rb', line 15

def verify(signature, data)
  signature == sign(data)
end