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