【问题标题】:How to create self signed SSL certificate for test purposes? [closed]如何为测试目的创建自签名 SSL 证书? [关闭]
【发布时间】:2012-12-25 09:02:39
【问题描述】:

如何轻松创建自签名 SSL 证书以进行测试?

【问题讨论】:

  • 请使用搜索,这应该已经被询问和回答了,如果不搜索其他 stackoverflow Q&A 网站,也请 // 近距离投票,但没有人建议重复 - 没有?

标签: ssl https ssl-certificate


【解决方案1】:

你可以通过 openssl 做到这一点:

  1. 安装 openssl 包(如果您使用的是 Windows,请下载二进制文件 here)。

  2. 生成私钥:openssl genrsa 2048 > private.pem

  3. 生成自签名证书:openssl req -x509 -days 1000 -new -key private.pem -out public.pem

  4. 如果需要,创建 PFX:openssl pkcs12 -export -in public.pem -inkey private.pem -out mycert.pfx

【讨论】:

  • 单线:openssl req -new -x509 -nodes -out server.crt -keyout server.key
  • 必须加-sha256,避免更多错误
  • 上述 Windows 二进制文件的链接不再起作用。 Openssl.org 本身不提供任何二进制文件,但在其wiki 中提供了二进制文件列表。
  • 对于 Windows 用户:Git Bash 包括 opensslGit 是开发者系统中必备的东西之一 ^)
  • 对于 windows,您可以在“C:\Program Files\Git\usr\bin\openssl.exe”找到它
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-01-11
  • 1970-01-01
  • 1970-01-01
  • 2011-09-28
  • 2017-07-21
  • 2014-03-02
  • 2017-02-18
相关资源
最近更新 更多