Chinaunix首页 | 论坛 | 博客
  • 博客访问: 713979
  • 博文数量: 140
  • 博客积分: 5097
  • 博客等级: 大校
  • 技术积分: 991
  • 用 户 组: 普通用户
  • 注册时间: 2006-01-05 19:13
文章分类

全部博文(140)

文章存档

2018年(1)

2015年(5)

2014年(5)

2013年(2)

2011年(16)

2010年(6)

2009年(9)

2008年(45)

2007年(26)

2006年(25)

分类: 网络与安全

2015-02-10 17:26:05

原文地址:CURL使用SSL证书访问HTTPS 作者:mfc42d

若服务端要求客户端认证,需要将pfx证书转换成pem格式

openssl pkcs12 -clcerts -nokeys -in cert.pfx -out client.pem    #客户端个人证书的公钥  

openssl pkcs12 -nocerts -nodes -in cert.pfx -out key.pem #客户端个人证书的私钥

也可以转换为公钥与私钥合二为一的文件

openssl pkcs12 -in  cert.pfx -out all.pem -nodes                                   #客户端公钥与私钥,一起存在all.pem中


执行curl命令

1、使用client.pem+key.pem

curl -k --cert client.pem --key key.pem

 

2、使用all.pem

curl -k --cert all.pem  

 

使用-k,是不对服务器的证书进行检查,这样就不必关心服务器证书的导出问题了。

阅读(6914) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~