我收到以下错误:
基础连接已关闭:接收
发生意外错误
创建包含所有必需值的POST的URL(VPSProtocol,TxType,Vendor,Crypt)
使用表单集成加密密码作为密钥和IV加密Crypt字段(包含所有必需的值)(RijndaelManaged)
实例化HttpWebRequest(KeepAlive = false; Method =“POST”(也尝试过GET))
SecurityProtocol = Tls12(也尝试过Ssl3和Tls)
最初我的主叫网站不是Https(没有SSL证书)
尝试创建自签名证书
加密过程使用MemoryStream / CryptoStream / StreamWriter加密要在Crypt参数中传递的数据
url复制Apendix A Crypt Field Example
Sagepay Url - https://test.sagepay.com/gateway/service/vspform-register.vsp我将这些参数附加到。
响应
基础连接已关闭:接收时发生意外错误。
string valsToCrypt = "VendorTxCode= ....etc
using (RijndaelManaged myRijndael = new RijndaelManaged())
{
var passToBytes = System.Text.Encoding.UTF8.GetBytes("pass val");
myRijndael.Key = passToBytes;
myRijndael.IV = passToBytes;
// Encrypt the string to an array of bytes.
byte[] encrypted = EncryptStringToBytes(valsToCrypt, myRijndael.Key, myRijndael.IV);
string cryptEncrypted = "";
foreach (byte item in encrypted)
{
cryptEncrypted += item;
}
string uri = "https://test.sagepay.com/gateway/service/vspform-register.vsp";
uri += "?VPSProtocol=3.00&TxType=PAYMENT&Vendor=vendorname&Crypt=@" + cryptEncrypted;
var webRequest = (HttpWebRequest)WebRequest.Create(uri);
webRequest.KeepAlive = false;
webRequest.Method = "POST";
几乎没有想法。