Skip to content

Instantly share code, notes, and snippets.

@lkdocs
Created September 11, 2013 16:50
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save lkdocs/6526465 to your computer and use it in GitHub Desktop.
Save lkdocs/6526465 to your computer and use it in GitHub Desktop.
require 'openssl'
def verify_sign(key, signature, data)
# Verifies with a public key that the data was signed with their private key
pubkey = key.public_key
if pubkey.verify(OpenSSL::Digest::SHA256.new, signature, data)
puts 'the signature is valid'
else
puts 'the signature is invalid'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment