<%
'
'查询通知应答类
'============================================================================
'api说明:
'getKey()/setKey(),获取/设置密钥
'getParameter()/setParameter(),获取/设置参数值
'getAllParameters(),获取所有参数
'isTenpaySign(),是否财付通签名,true:是 false:否
'getDebugInfo(),获取debug信息
'
'============================================================================
'

Class TmallResponseHandler

'密钥
Private key

'应答的参数
Private parameters

'debug信息
Private debugInfo

'初始构造函数
Private Sub class_initialize()
key = ""
Set parameters = Server.CreateObject("Scripting.Dictionary")
debugInfo = ""

parameters.RemoveAll
'GET
For Each k In Request.QueryString
v = Request.QueryString(k)
setParameter k,v
Next

'POST
For Each k In Request.Form
v = Request(k)
setParameter k,v
Next

End Sub

'获取密钥
Public Function getKey()
getKey = key
End Function

'设置密钥
Public Function setKey(key_)
key = key_
End Function

'获取参数值
Public Function getParameter(parameter)
getParameter = parameters.Item(parameter)
End Function

'设置参数值
Public Sub setParameter(parameter, parameterValue)
If parameters.Exists(parameter) = True Then
parameters.Remove(parameter)
End If
parameters.Add parameter, parameterValue
End Sub

'获取所有请求的参数,返回Scripting.Dictionary
Public Function getAllParameters()
getAllParameters = parameters
End Function

'是否Tmall签名
'true:是 false:否
Public Function isTamllSign()

timestamp = getParameter("timestamp")
order_id = getParameter("order_id")
mobile = getParameter("mobile")
num = getParameter("num")
method = getParameter("method")
taobao_sid = getParameter("taobao_sid")
seller_nick = getParameter("seller_nick")
item_title = getParameter("item_title")
send_type = getParameter("send_type")
consume_type = getParameter("consume_type")
sms_template = getParameter("sms_template")
valid_start = getParameter("valid_start")
valid_ends = getParameter("valid_ends")
num_iid = getParameter("num_iid")
outer_iid = getParameter("outer_iid")
sub_outer_iid = getParameter("sub_outer_iid")
sku_properties = getParameter("sku_properties")
token = getParameter("token")
total_fee = getParameter("total_fee")
weeks = getParameter("weeks")
left_num = getParameter("left_num")
'sign 不在能当道待加密的串里
signPars = Array("consume_type="&consume_type, "item_title="&item_title, "left_num="&left_num,"method="&method, "mobile=" & mobile,"num="&num, "num_iid="&num_iid, "order_id="&order_id,"outer_iid="&outer_iid, "seller_nick="&seller_nick, "send_type="&send_type, "sku_properties="&sku_properties , "sms_template="&sms_template, "sub_outer_iid="&sub_outer_iid,"taobao_sid="&taobao_sid, "timestamp="&timestamp, "token="&token, "total_fee="&total_fee,"valid_ends="&valid_ends, "valid_start="&valid_start, "weeks=" & weeks)

Count=ubound(signPars)
'For i = Count TO 0 Step -1
' minmax = signPars( 0 )
' minmaxSlot = 0
' For j = 1 To i
' mark = (signPars( j ) > minmax)
' If mark Then
' minmax = signPars( j )
' minmaxSlot = j
' End If
' Next
' If minmaxSlot <> i Then
' temp = signPars( minmaxSlot )
' signPars( minmaxSlot ) = signPars( i )
' signPars( i ) = temp
' End If
' Next

For j = 0 To Count Step 1
value = SPLIT(signPars( j ), "=")
If value(1)<>"" then
param= param&value(0)&value(1)
End If
Next

inputkey = key&param

Dim sign
sign= UCase(ASP_MD5(inputkey))

Dim tmallSign
tmallSign = UCase(getParameter("sign"))

'debugInfo
debugInfo = " => sign:" & sign & " TmallSign:" & tmallSign &" md5 "&ASP_MD5(inputkey)&" md5str "&inputkey

isTamllSign = (sign = tmallSign)

End Function

'获取debug信息
Function getDebugInfo()
getDebugInfo = debugInfo
End Function

End Class

%>

Tmall发送码asp验证sing(自有码开发)的更多相关文章

  1. NodeJS 微信公共号开发 - 响应微信发送的Token验证(山东数漫江湖)

    背景 使用 NodeJS 进行微信公共号开发,首先需要响应微信发送的Token验证,官方文档 填写服务器配置 登录微信公共平台,在开发下的基本配置打开该页面. 依次填写接口的 URL.自定义的 Tok ...

  2. asp.net mvc源码分析-DefaultModelBinder 自定义的普通数据类型的绑定和验证

    原文:asp.net mvc源码分析-DefaultModelBinder 自定义的普通数据类型的绑定和验证 在前面的文章中我们曾经涉及到ControllerActionInvoker类GetPara ...

  3. asp.net mvc源码分析-ModelValidatorProviders 客户端的验证

    几年写过asp.net mvc源码分析-ModelValidatorProviders 当时主要是考虑mvc的流程对,客户端的验证也只是简单的提及了一下,现在我们来仔细看一下客户端的验证. 如图所示, ...

  4. 初入码田--ASP.NET MVC4 Web应用开发之一 实现简单的登录

    初入码田--ASP.NET MVC4 Web应用之创建一个空白的MVC应用程序 初入码田--ASP.NET MVC4 Web应用开发之二 实现简单的增删改查 2016-07-24 一.创建T4模板,建 ...

  5. OpenID Connect Core 1.0(四)使用授权码流验证(上)

    3.1 使用授权码流验证(Authentication using the Authorization Code Flow) 本节描述如何使用授权码流执行验证.当使用授权码流时,会从令牌终结点返回的所 ...

  6. C# 动态生成word文档 [C#学习笔记3]关于Main(string[ ] args)中args命令行参数 实现DataTables搜索框查询结果高亮显示 二维码神器QRCoder Asp.net MVC 中 CodeFirst 开发模式实例

    C# 动态生成word文档 本文以一个简单的小例子,简述利用C#语言开发word表格相关的知识,仅供学习分享使用,如有不足之处,还请指正. 在工程中引用word的动态库 在项目中,点击项目名称右键-- ...

  7. 一个由正则表达式引发的血案 vs2017使用rdlc实现批量打印 vs2017使用rdlc [asp.net core 源码分析] 01 - Session SignalR sql for xml path用法 MemCahe C# 操作Excel图形——绘制、读取、隐藏、删除图形 IOC,DIP,DI,IoC容器

    1. 血案由来 近期我在为Lazada卖家中心做一个自助注册的项目,其中的shop name校验规则较为复杂,要求:1. 英文字母大小写2. 数字3. 越南文4. 一些特殊字符,如“&”,“- ...

  8. ASP.NET MVC 源码分析(一)

    ASP.NET MVC 源码分析(一) 直接上图: 我们先来看Core的设计: 从项目结构来看,asp.net.mvc.core有以下目录: ActionConstraints:action限制相关 ...

  9. ASP.NET Core[源码分析篇] - Authentication认证

    原文:ASP.NET Core[源码分析篇] - Authentication认证 追本溯源,从使用开始 首先看一下我们通常是如何使用微软自带的认证,一般在Startup里面配置我们所需的依赖认证服务 ...

随机推荐

  1. bzoj 1196 二分+生成树判定

    我们先二分一个答案,对于每个答案,先加一级公路,如果不够k直接break, 然后再加二级公路,加的过程类似Kruskal. /************************************* ...

  2. Spring MVC 入门教程示例 (一)

    今天和大家分享下  Spring MVC  入门教程 首先还是从 HelloWorld  web 工程开始 -------------------------- 1.首先创建一个Maven Web工程 ...

  3. 【BZOJ】【1028】【JSOI2007】麻将

    暴力/模拟 $n\leq400$,嗯……这是一个很小的数据范围= = 判断一副牌是不是听牌并求出听什么牌太麻烦了,干脆我们直接判是不是胡牌好了~ 枚举胡的是哪张牌,然后判一下加上这张牌后是否能胡. 算 ...

  4. nsight 初级使用指南

    1.安装,没有什么特殊设置 2.打开vs,编译生成你需要分析的.exe,在vs上方菜单,有nsight menu, choose Start Graphics Debugging. 3.在弹出对话框中 ...

  5. ios获取远程json数据

    NSMutableArray *arr; arr = [[NSMutableArray alloc]init];//全局 NSURL *url = [NSURL URLWithString:@&quo ...

  6. WARNING: Calls to any function that may require a gradient calculation inside a conditional block may return undefined results

    GLES2.0: Some device will give a warning on compling shaders(yet the compling will succeed), and the ...

  7. myeclipse 反编译插件 jad 安装

    1.  准备工作 下载jad.exe文件:http://www.varaneckas.com/sites/default/files/jad/jad158g.win.zip 下载jadeclipse插 ...

  8. IT架构之IT架构模型——思维导图

    参考: [日] 野村综合研究所系统咨询事业本部. 图解CIO工作指南. 周自恒译 人民邮电出版社,2014

  9. P==NP??

    注:基础知识见下方 下面是关于P==NP ???  一些讨论,挺好玩的. 1. 首先强调一下数学上还没有证明这个问题!但是我们看看其他角度来看这个问题. 其次,心理上来说,要是可以证明P==NP那么早 ...

  10. UVA 11610 Reverse Prime (数论+树状数组+二分,难题)

    参考链接http://blog.csdn.net/acm_cxlove/article/details/8264290http://blog.csdn.net/w00w12l/article/deta ...