Sha256: 4aed4784cb6c9f15b1985f6dd34926f992e004d2db2fb2ee8f3a3ee5ab1cf3c5

Contents?: true

Size: 409 Bytes

Versions: 1

Compression:

Stored size: 409 Bytes

Contents

require 'openssl'
require 'base64'

module LlPay
  module Sign
    class RSA
      def self.sign(prikey, string)
        rsa = OpenSSL::PKey::RSA.new(prikey)
        Base64.strict_encode64(rsa.sign('sha1', string))
      end

      def self.verify?(pubkey, string, sign)
        rsa = OpenSSL::PKey::RSA.new(pubkey)
        rsa.verify('sha1', Base64.strict_decode64(sign), string)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ll_pay-0.2.0 lib/ll_pay/sign/rsa.rb