Sha256: c7ba629a47254871f98c1221409260b93ef35f69f0573617d8c73057f06065b6
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
module Alipay module Wap module Sign ALIPAY_RSA_PUBLIC_KEY = <<-EOF -----BEGIN PUBLIC KEY----- MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCQwpCPC4oB+clYNBkKQx3gfyFl Ut3cpRr5oErt OypLKh6j1UmTDSpfsac29h1kC0HIvLmxWbPuoxcsKDlclgRPeWn IxrpSF9k5Fu6SRy3+AOdIKrDO SHQ7VwUsNih2OnPbztMSMplGnQCBa1iec2r+38 Udmh5Ua2xg6IEfk493VQIDAQAB -----END PUBLIC KEY----- EOF def self.verify?(params, options = {}) params = Utils.stringify_keys(params) sign = params.delete('sign') string = params_to_string(params) case params['sec_id'] when 'MD5' key = options[:pid] || Alipay.key ::Alipay::Sign::MD5.verify?(key, string, sign) when '0001' # RSA ::Alipay::Sign::RSA.verify?(ALIPAY_RSA_PUBLIC_KEY, string, sign) else raise ArgumentError, "[Alipay] Invalid sec_id, allow value: 'MD5', '0001'" end end SORTED_VERIFY_PARAMS = %w( service v sec_id notify_data ) def self.params_to_string(params) SORTED_VERIFY_PARAMS.map do |key| "#{key}=#{params[key]}" end.join('&') end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alipay-0.6.0.beta2 | lib/alipay/wap/sign.rb |