Sha256: 8140a04f1329869febe11dabb41b7fe72f16fb71c015c0ecc0b64caeca5fb4e5
Contents?: true
Size: 398 Bytes
Versions: 14
Compression:
Stored size: 398 Bytes
Contents
require 'openssl' require 'base64' module Alipay module Sign class RSA def self.sign(key, string) rsa = OpenSSL::PKey::RSA.new(key) Base64.strict_encode64(rsa.sign('sha1', string)) end def self.verify?(key, string, sign) rsa = OpenSSL::PKey::RSA.new(key) rsa.verify('sha1', Base64.strict_decode64(sign), string) end end end end
Version data entries
14 entries across 14 versions & 2 rubygems