表单 – 使用经典ASP加密加密字段以进行SagePay表单集成

前端之家收集整理的这篇文章主要介绍了表单 – 使用经典ASP加密加密字段以进行SagePay表单集成前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我总是得到相同的错误3045:发布此表单时缺少货币字段:
<form name="frmPay" action="https://test.sagepay.com/gateway/service/vspform-register.vsp" method="POST">
<input type="text" name="VPSProtocol" value="3.00" />
<input type="text" name="TxType" value="PAYMENT" />
<input type="text" name="Vendor" value="myvendor" />    
Crypt:<textarea rows="10" cols="200" name="Crypt"><%=Crypt%></textarea>
<input type="submit" value="Send" />
</form>

我认为错误在于加密

有人可以为经典ASP发送加密例程吗?

解决方法

UPDATE (19-Nov-2014): A useful link has come to light through 07000 on this topic.

07001

The file contains Classic ASP example of how to implement AES (128-bit) using a modified version of the AES Rijndael Block Cipher originally written by Phil Fresle (2001) but has been modified by Mat Peck at Sage Pay to run with 128-bit blocks (AES) with CBC and PKCS#5 padding.

The Classic ASP example contains two files

06000

Sage Pay Form Integration要求非常具体.

From 07002

A1.1 The Crypt Field

  1. The Crypt field should contain all the other transaction information (see the next section) in plain text as Name=Value fields
    separated by ‘&’ characters. Ensure that all mandatory fields are present and that there are no spaces after the ‘&’ character.

  2. This string should then be encrypted using AES(block size 128-bit) in CBC mode with PKCS#5 padding using the provided
    password as both the key and initialisation vector and encode the result in hex (making sure the letters are in upper case).

  3. Prepend the @ sign to the beginning of the encoded result.

NB : To decrypt use the same procedure in decryption mode,making sure you remove the @ sign before doing so.


Example Crypt Field

Using the key 55a51621a6648525
To encrypt the following request we should get the encrypted result below it

Key Value Pairs

06001

Encrypted Result

06002

考虑到这些要求意味着您对经典ASP环境中可用选项的限制.

我建议看看使用AspEncrypt by Persit Software或我能找到的唯一其他有前途的选项是(Classic ASP) AES Encryption,但由于我没有使用这些组件中的任何一个,我无法保证它们有多好或多坏.

但是我之前在使用经典ASP进行Web开发时使用过Persit组件,并且可以说它们一直对我有用,所以我的建议是看看你的想法.

它确实似乎支持所需的要求,这里是一个示例based on code from the documentation操纵适合.

<%
Dim CM,Context,Key,Blob,Crypt

Set CM = Server.CreateObject("Persits.CryptoManager")
'AES requires the Microsoft Enhanced RSA and AES Cryptographic Provider.
'Set Context = CM.OpenContext("",True )
Set Context = CM.OpenContextEx( _
  "Microsoft Enhanced RSA and AES Cryptographic Provider","",True _
)
Set Blob = CM.CreateBlob
Blob.Hex = "Hex Encoded Key given to you by Sage Pay" 'AES-128 Bit Key
'Might need to reverse the bytes which is why the third parameter is set to True.
Set Key = Context.ImportRawKey(Blob,calgAES128,True)

'Make sure padding is set to PKCS#5 and Cipher Mode is set to CBC
'these don't actually need defining because they are the defaults
'according to the documentation,just here for completeness.
Key.Padding = ccpPKCS5
Key.Mode = ccmCBC
Set Blob = Key.EncryptText("your key value pairs")

'Format encrypted field as required by Sage Pay
Crypt = "@" + Blob.Hex
%>

有用的链接

>这个问题似乎是相关的,但对于PHP而不是经典ASP这个问题虽然相似. PHP and Sage Pay.
> Article PS040625142 – Advanced Encryption Standard (AES) Support

原文链接:https://www.f2er.com/html/231150.html

猜你在找的HTML相关文章