利用curl验证ssl网站(webservice)
curl的用法:
http://linux.about.com/od/commands/l/blcmdl1_curl.htm
DER格式的cert轉換為PEM格式(curl只接受PEM格式):
openssl x509 -inform der -in cert.cer -out cert.pem
curl命令示意:
curl --cacert rootca.pem (或--capath 'certpath'?-H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: "http://tempuri.org/HeartBeat"' https://xxxx.asmx -data @heartbeat.xml
?
curl 的--capath參數:
在capath指明的路徑下存放著驗證ssl網站的證書鏈,必須用c_rehash進行處理的。c_rehash就類似如下代碼:
for file in *.pem; doln -s $file `openssl x509 -hash -noout -in $file `.0; done
?
heartbeat.xml是參數經過htmlencode的文件:
BTGS不讓拷貝東西,我只有大概描述下了。<soap12:Envelope>和<soap12:body>是固定的,webservice都差不多。
<soap12:body>下面是<HeartBeat xmlns="http://tempuri.org/">, 參數只有一個<who>內容是轉義的,比如“<”要替換成“<“等,網上有在線轉義工具。
?
BTGS受不了了,向分享總結個東西都這么的費勁。
轉載于:https://www.cnblogs.com/Persue-A-Good-Life/p/4135909.html
總結
以上是生活随笔為你收集整理的利用curl验证ssl网站(webservice)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 用PHP忙了一晚上写的图片缩略和图片等比
- 下一篇: [跟我学UML] UML中的对象图