Openssl 添加证书时出错:将证书添加到数据库时出错

Openssl 添加证书时出错:将证书添加到数据库时出错,openssl,ssl-certificate,certutil,Openssl,Ssl Certificate,Certutil,尝试在Ubuntu上为localhost配置有效的SSL证书时,我遇到以下错误: certutil -d sql:$HOME/.pki/nssdb -A -t "CT,c,c" -n "localhost" -i localhost.crt certutil:无法将证书添加到令牌或数据库: 添加证书时出错:将证书添加到数据库时出错 此证书将用于Nginx配置,我的目标是避免Google Chrome中出现任何错误(ERR_SSL_PROTOCOL_ERR

尝试在Ubuntu上为localhost配置有效的SSL证书时,我遇到以下错误:

certutil -d sql:$HOME/.pki/nssdb -A -t "CT,c,c" -n "localhost" -i localhost.crt
certutil:无法将证书添加到令牌或数据库: 添加证书时出错:将证书添加到数据库时出错


此证书将用于Nginx配置,我的目标是避免Google Chrome中出现任何错误(ERR_SSL_PROTOCOL_ERROR),因为证书颁发机构不受信任。

发生此错误是因为证书以前已使用certutil注册

解决方案

  • 删除现有记录

    certutil-n localhost-D localhost.crt

  • 然后,创建一个新记录

    certutil-dsql:$HOME/.pki/nssdb-A-t“CT,c,c”-n“localhost”-i localhost.crt