Module: BugBunny::Security
- Defined in:
- lib/bug_bunny/security.rb
Class Method Summary collapse
Class Method Details
.check_sign(key, signature, message) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/bug_bunny/security.rb', line 9 def self.check_sign(key, signature, ) pub_key = OpenSSL::PKey::RSA.new(key) digest = OpenSSL::Digest.new('SHA512') if pub_key.verify(digest, Base64.decode64(signature), ) true else false end end |
.sign_message(secret, message) ⇒ Object
3 4 5 6 7 |
# File 'lib/bug_bunny/security.rb', line 3 def self.(secret, ) digest = OpenSSL::Digest.new('SHA512') private_key = OpenSSL::PKey::RSA.new(secret) Base64.encode64(private_key.sign(digest, )) end |