win2008R2/Win7启用TLS 1.2实践

由于项目需要用到PayPal, 就去研究了下paypal,但是PayPal需要TLS 1.2, 就google了一把,这里把整个流程写下来

准备

Tips:

  1. 公司服务器整体结构是 windows 2008R2 + IIS + PHP

  2. 使用PhpStudy,使用其他的也没问题

说一下win7也可以, 可以拿来做测试.如果使用win7来测试,需要控制面板>程序和功能>启用和关闭windows组件 开启IIS组件(怎样开启,自行google)

如果服务器是apache,只需要使用高版本的php_openssl扩展就行了,选用apche+PHP5.5n我已经确认可用, php5.6会报错找不到某某加密函数

PayPal的需求是

  1. PHP_VERSION >= 5.3

  2. php_curl, php_openssl 必须启用

  3. composer(怎样安装参考http://www.phpcomposer.com)

phpStudy切换到 IIS7/8 + PHP 5.5n

这里说一声, 选这PHP 5.5之前的版本, 由于openssl扩展的版本过低, 可能不支持, 我选5.4就不支持

下载PayPal的sdk

地址:https://github.com/paypal/Pay...
克隆到你的网站目录
打开git bash

git clone https://github.com/paypal/PayPal-PHP-SDK.git paypal
cd paypal
composer update

其实就是把代码下载下来, 复制到paypal目录, 然后在目录在命令行执行composer update

配置TLS1.2

分为2步, 添加TLS配置和禁用老的SSL版本

配置TLS1.2

提供两种方法, 选择其中一种就行了

手动设置

找到HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols右键->新建->项->新建TLS 1.1,TLS 1.2
TLS 1.1和TLS 1.2 右键->新建->项->新建Server, Client
在新建的Server和Client中都新建如下的项(DWORD 32位值), 总共4个

DisabledByDefault [Value = 0]
Enabled [Value = 1]

如图

直接导入注册表文件

如下, 是我从我的注册表里面导出来的, 新建文本文件, 后缀名改为reg就行了, 双击导入

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Client]
"DisabledByDefault"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client]
"DisabledByDefault"=dword:00000000
"Enable"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server]
"DisabledByDefault"=dword:00000000
"Enable"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client]
"DisabledByDefault"=dword:00000000
"Enable"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server]
"DisabledByDefault "=dword:00000000
"Enable"=dword:00000001

禁用老SSL配置

打开HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Client 配置如下

DisabledByDefault [Value = 0]
Enabled [Value = 0]

测试

打开网站, 我的是部署到局域网的,

192.168.1.99/paypal/sample


如果你配置了apiContent是有数据出来的,我没有配置, 所以就只是No Data

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值