Delphi 连接 SSL TLS 1.2


本文整理自网络,侵删。

 
台湾最近银行与第三方支付、行动支付发展越来越快,而Delphi使用indy元件时,如果处理SSL网站时不是很容易。
后来找到了ipwork的元件还不错用。
列一下关键的程式
ipwhttp1 := Tipwhttp.Create(Application);
ipwhttp1.Config('CodePage=65001');
posturl:=posturl+'barcode='+sBarcode;
ipwhttp1.Post(sPaymentURL+'?'+posturl);
result:=UTF8ToString(ipwhttp1.TransferredData);
ipwhttp1.free;
另外处理像SHA/AES等加解密也很方便

function GetTokenKey(s:String):String;
var ipcHash1: TipcHash;
begin
ipcHash1 := TipcHash.Create(Application);
ipcHash1.Reset();
ipcHash1.Algorithm := TipcHashAlgorithms(haSHA256);
ipcHash1.InputMessage := s;
ipcHash1.ComputeHash();
result :=lowercase(ipcHash1.HashValue);
ipcHash1.Free;
end;

来源:http://superlevin.ifengyuan.tw/delphi-%E9%80%A3%E6%8E%A5-ssl-tls-1-2-%E7%AC%AC%E4%B8%89%E6%96%B9%E6%94%AF%E4%BB%98%E9%87%91%E6%B5%81%E5%95%8F%E9%A1%8C/

相关阅读 >>

Delphi 得到文件创建时间,修改时间,访问时间

Delphi逐个读取access中的数据

Delphi关于dbgrid和webbrowser的焦点问题

Delphi clientdataset复制记录

Delphi 把流中的字符串转换为 utf 格式

Delphi insert 插入一个字符(串)

Delphi 获取鼠标坐标

Delphi access 数据库压缩

Delphi获取网卡mac地址的两种方法

Delphi示例代码 android,ios,osx,windows,linux,html5

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...