Skip to content

Instantly share code, notes, and snippets.

@alecguintu
Last active March 17, 2020 07:21
Show Gist options
  • Save alecguintu/60ccd8f0cc0c2ed5e8a1748b70897734 to your computer and use it in GitHub Desktop.
Save alecguintu/60ccd8f0cc0c2ed5e8a1748b70897734 to your computer and use it in GitHub Desktop.
def verify_response(response, response_signature)
public_key_pem = File.read(Rails.root.join('config', 'gcash-public-key2.pem'))
public_key = OpenSSL::PKey::RSA.new(public_key_pem)
signature_dest = Base64.strict_decode64(response_signature)
public_key.verify(OpenSSL::Digest::SHA256.new, signature_dest, response.to_json)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment