<%
'
'查询通知应答类
'============================================================================
'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. Net数值计算MathNet.Numerics类库

    一.Net自带的数值计算:System.Numerics 1.大整数BitInteger 方法:除数和余数.最大公约数 2.复数Complex 属性:实部.虚部.量值.相位 方法:共轭.倒数 二.Ma ...

  2. window.showModalDialog的传值和返回值

    window.showModalDialog(URL,dialogArgments,features) 打开一个新窗口 URL为要将打开的网页地址. dialogArgments为设定好传递给新视窗网 ...

  3. Redis杂记

    参考资料: Redis 教程 | 菜鸟教程 : http://www.runoob.com/redis/redis-tutorial.html Redis快速入门 :http://www.yiibai ...

  4. 浏览器解析HTML文档的资源并下载

    <img />,<style>这些资源是并行请求与加载. <script>脚本是同步请求与加载,阻塞加载.加载完成并执行后再继续解析HTML. 动态<scri ...

  5. 【高可用HA】Apache (1) —— Mac下安装Apache Httpd到自定义路径(非/etc/apache2)

    Mac下安装Apache Httpd httpd版本: httpd-2.4.17 参考来源: Tomcat Clustering - A Step By Step Guide Apache HTTP ...

  6. c#中的线程一

    一.使用线程的理由 1.可以使用线程将代码同其他代码隔离,提高应用程序的可靠性. 2.可以使用线程来简化编码. 3.可以使用线程来实现并发执行 二.基本知识 1.进程与线程:进程作为操作系统执行程序的 ...

  7. static_cast和reinterpret_cast

    static_cast和reinterpret_cast 相同点:都是暴力转换,从一个类型转换为另一个类型,对于类指针不会保证安全性   static_cast和reinterpret_cast的区别 ...

  8. 【回文字符串】 最长回文子串O(N) Manacher算法

    原理讲的清晰:Manacher's ALGORITHM: O(n)时间求字符串的最长回文子串 注意: ①动态生命P[]和newStr数组后,不要忘记delete[] //其实这是基本的编码习惯 ②最终 ...

  9. 高质量图形库:pixellib

    点这里 pixellib 是高质量 2D 图形库: 高质量抗锯齿,矢量图形绘制 多种图像格式: RGB, BGR, ARGB, ABGR, RGBA, BGRA 8 / 15 / 16 / 24 / ...

  10. [转载] ACE 组播校验和出错问题解决

    源地址:http://yuanmuqiuyu2000.blog.sohu.com/140904942.html 使用ACE框架写了个组播简单的测试工具,但是测试过程中,总是发现udp校验和出错的信息. ...