在 Windows 上创建 OpenSSL 证书

由于我对 SSL 证书非常陌生,而且我认为 StackOverflow 成员可以帮助我创建和使用它们。

我来自荷兰,通常的在线支付方式是实现 iDEAL。一个由主要银行支持的在线支付协议。我必须实现一个“专业”的版本。这包括创建 RSA 私钥。基于这个密钥,我必须创建一个证书并将其上传到网络服务器。

我在一台 Windows 机器上,完全不知道该做什么。我看了一下 OpenSSL 网站,因为手册将我转发到该网站以获得一个 SSL 工具包。

手册提供了两个命令,为了创建 RSA 密钥和证书,必须执行这两个命令。

命令是:

openssl genrsa -des3 –out priv.pem -passout pass:myPassword 1024

还有

openssl req -x509 -new -key priv.pem -passin pass:myPassword -days 3650 -out cert.cer

有没有什么方法可以通过 Windows 机器上的实用程序来实现这一点?我下载了 PuTTy KeyGenerator。但是我不知道该怎么做,我已经创建了一个密钥(SSH-2 RSA,不管它是什么。.)但是如何用这个密钥创建证书呢?

252446 次浏览

You can download a native OpenSSL for Windows, or you can always use Cygwin.

You can certainly use putty (puttygen.exe) to do that.

Or you can get Cygwin to use the utilities you just described.

To create a self signed certificate on Windows 7 with IIS 6...

  1. Open IIS

  2. Select your server (top level item or your computer's name)

  3. Under the IIS section, open "Server Certificates"

  4. Click "Create Self-Signed Certificate"

  5. Name it "localhost" (or something like that that is not specific)

  6. Click "OK"

You can then bind that certificate to your website...

  1. Right click on your website and choose "Edit bindings..."

  2. Click "Add"

    • Type: https
    • IP address: "All Unassigned"
    • Port: 443
    • SSL certificate: "localhost"
  3. Click "OK"

  4. Click "Close"

If you're on windows and using apache, maybe via WAMP or the Drupal stack installer, you can additionally download the git for windows package, which includes many useful linux command line tools, one of which is openssl.

The following command creates the self signed certificate and key needed for apache and works fine in windows:

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout privatekey.key -out certificate.crt