【发布时间】:2015-07-28 17:31:52
【问题描述】:
我正在尝试连接到需要相互身份验证的远程服务器。我从服务器收到一个 .p12 文件,并使用以下命令生成我的私钥和客户端证书:
openssl pkcs12 -in my_dev.p12 -out clientCert.crt -nokeys -clcerts
openssl pkcs12 -in my_dev.p12 -nocerts -nodes -passin pass:mypassword | openssl rsa -out privkey.pem
我使用以下代码设置了 Manticore 客户端:
client = Manticore::Client.new(
pool_max: 200,
pool_max_per_route: 200,
ssl: { verify: :disable, client_key: client_key , client_cert: client_cert })
url = "https://my_url.com"
resp = client.get(url).call
我得到的回应是这样的:
401 Unauthorized
Unauthorized
This server could not verify that you\nare authorized to access the document
requested. Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn't understand how to supply
the credentials required.
我对使用相互身份验证非常陌生,并且不确定我到底哪里出错了。我是否正确提取了 clientCert 和 privateKey?我是否正确地向 Manticore 提供密钥和证书?
【问题讨论】:
标签: ruby jruby mutual-authentication