NSS: client certificate not found (nickname not specified)报错排查及解决

curl: (35) NSS: client certificate not found (nickname not specified)

排查好久,这里记录下这个坑。

初始

这是第三方的一个接口,测试联调时,curl https://xxx.com.cn发现提示证书未信任,

curl: (60) Peer's certificate issuer has been marked as not trusted by the user.
More details here: http://curl.haxx.se/docs/sslcerts.htmlcurl performs SSL certificate verification by default, using a "bundle"of Certificate Authority (CA) public keys (CA certs). If the defaultbundle file isn't adequate, you can specify an alternate fileusing the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented inthe bundle, the certificate verification probably failed due to aproblem with the certificate (it might be expired, or the name mightnot match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, usethe -k (or --insecure) option.

看到熟悉的报错,我知道将对方自签名证书的CA加入信任即可。一通操作之后却还是不行,但是报错变成了新的.

curl: (35) NSS: client certificate not found (nickname not specified)

-vvv也还是没发现什么新的有用信息。
curl -vvv https://xxxxx 时总是报错

* About to connect() to xxx.com.cn port 8912 (#0)
*   Trying 111.122.224.223...
* Connected to gwtest.ccic-net.com.cn (111.122.224.223) port 8912 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crtCApath: none
* NSS: client certificate not found (nickname not specified)
* NSS error -12227 (SSL_ERROR_HANDSHAKE_FAILURE_ALERT)
* SSL peer was unable to negotiate an acceptable set of security parameters.
* Closing connection 0
curl: (35) NSS: client certificate not found (nickname not specified)

原因

其实报错提示很明显,client certificate not found,开始没想到是双向认证,一直以为是CA根证书信任没弄好,结果一直无法解决。

解决

找第三方拿到客户端证书jks证书(p12)。

openssl pkcs12 -in xxx.p12 -out client.pem -nokeys       #客户端个人证书的公钥
openssl pkcs12 -in xxx.p12 -out key.pem -nocerts -nodes     #客户端个人证书的私钥
也可以转换为公钥与私钥合二为一的文件;
openssl pkcs12 -in xxx.p12 -out all.pem -nodes                                   #客户端公钥与私钥,一起存在all.pem中

使用client.pem+key.pem

curl --cert client.pem --key key.pem https://www.xxxx.com

或使用all.pem

curl --cert all.pem  https://www.xxxx.com

问题解决~

NSS: client certificate not found (nickname not specified)相关推荐

  1. unable to load client certificate private key file

    解决方法可以跳过看最后!!!o( ̄︶ ̄)o 终端执行 openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert MyPus ...

  2. OpenShift 4 - 获取能访问API服务的用户认证Token

    <OpenShift 4.x HOL教程汇总> 说明:本文已经在OpenShift 4.7环境中验证 文章目录 方法1 方法2 方法3 参考 方法1 $ oc login -u admin ...

  3. kubernetes1.5.2版本 yum install 方式安装部署 认证授权机制 安全模式 完整版

    https://www.sohu.com/a/316191121_701739 https://zhuanlan.zhihu.com/p/31046822 https://kubernetes.io/ ...

  4. The Elastic Stack (ELK)7.14:简单配置到SSL配置教程(带Beats部署)

    文章目录 一.简介 二.环境 1.安装Docker.Docker Compose 三.部署Elastic Stack(ELK) 1.部署ElasticSearch(Distributed, RESTf ...

  5. java keystore ca_PKCS12 Java Keystore from CA and User certificate in java

    问题 I've recently been put in charge of mocking up an Apple product (iPhone Configuration Utility) in ...

  6. Mikrotik: Setup SSTP Server for Windows 10 Client

    原文: http://www.dr0u.com/mikrotik-setup-sstp-server-for-windows-10-client/ Basic how-to on SSTP for a ...

  7. 使用NGINX作为HTTPS正向代理服务器

    NGINX主要设计作为反向代理服务器,但随着NGINX的发展,它同样能作为正向代理的选项之一.正向代理本身并不复杂,而如何代理加密的HTTPS流量是正向代理需要解决的主要问题.本文将介绍利用NGINX ...

  8. python搭建https代理服务器_使用NGINX作为HTTPS正向代理服务器

    NGINX主要设计作为反向代理服务器,但随着NGINX的发展,它同样能作为正向代理的选项之一.正向代理本身并不复杂,而如何代理加密的HTTPS流量是正向代理需要解决的主要问题.本文将介绍利用NGINX ...

  9. curl 输出接口请求响应时间

    文章目录 前言 一.curl介绍 二.具体使用 1.当前目录新建文件 2.执行命令 3.结果 总结 前言 系统需求中需要请求第三方数据接口获取数据,那线上请求第三方接口耗时多少?今天给大家分享一个干货 ...

最新文章

  1. R语言使用upper.tri函数、lower.tri函数、diag函数改变matrix矩阵上三角形、下三角形、对角线的数值
  2. Informix IDS 11体系打点(918考试)认证指南,第 5 局部: 数据库管事器操作(4)
  3. 软件项目管理0720:读一页项目管理-项目子目标
  4. vue响应的res.data和res.data.data
  5. Java Web学习(五)session、cookie、token
  6. 局部变量、全局变量、堆、堆栈、静态和全局
  7. Java REST JAX-RS 2.0 –如何处理日期,时间和时间戳记数据类型
  8. android web通讯录,Android手机开发之通讯录
  9. Python为数据添加拉普拉斯噪声Laplace noise
  10. win11不显示缩略图怎么办 windows11不显示缩略图的解决方法
  11. argparse及logging的相关用法
  12. 记录一下 orangepi zero wifi联网
  13. ❤️「Python」初阶,必看系列, 万字只为你,建议点赞收藏~❤️
  14. 人人都是产品经理——一切从Kick Off开始
  15. STM32F103 GPIOA->CRL=0XFFF0FFFF配置端口方向
  16. python头歌--文件翻转
  17. 华为mate40计算机,华为Mate40兼容欧米多手机电脑,秒变笔电轻办公
  18. 对开发初步认识和体验
  19. unity python热更新_Unity热更新介绍和测试方法
  20. 如何以正确地姿势AK SQL查询50题(精华篇)

热门文章

  1. 2022国际数维杯C题题解:利用大脑结构特征和认知行为特征诊断阿尔茨海默病
  2. MATLAB机器学习进阶
  3. 西电李航 操作系统课程笔记 day8 Implementation of File system
  4. 【mindspore】mindspore脚本迁移经历
  5. MongoDB 文档数据库
  6. 01.swagger
  7. 百度深度学习框架paddlepaddle实战三——自家车牌识别
  8. C语言计算一个整数的位数
  9. Python编程——爬小说《星辰变》
  10. 电子科技大学 编译原理期末女娲补天