Class: Linzer::RSA::Key

Inherits:
Key
  • Object
show all
Defined in:
lib/linzer/rsa.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
14
# File 'lib/linzer/rsa.rb', line 11

def sign(data)
  # XXX: should check if the key is usable for signing
  @material.sign(@params[:digest], data)
end

#validateObject



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

def validate
  super
  validate_digest
end

#verify(signature, data) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/linzer/rsa.rb', line 16

def verify(signature, data)
  # XXX: should check if the key is usable for verifying
  return true if @material.verify_pss(
    @params[:digest],
    signature,
    data,
    salt_length: @params[:salt_length] || :auto,
    mgf1_hash:   @params[:digest]
  )
  false
end