windows で自己証明書作成

Windows
この記事は1年以上前に書かれたものです。 情報が古い可能性があります。

ググればいっぱい出てくるけど、Black Jumbo Dog で検証用に HTTPS を手っ取り早く立てたかったため、 powershell で ptx 形式の証明書を作るメモ。

$cert = New-SelfSignedCertificate `
            -Type SSLServerAuthentication `
            -Subject "www.naokilog.com" `
            -DnsName "naokilog.com" `
            -CertStoreLocation "cert:\LocalMachine\My" `
            -KeyDescription "Self-signed certificate" `
            -KeyExportPolicy Exportable `
            -NotAfter (Get-Date).AddYears(1)


$MyPwd = ConvertTo-SecureString `
            -String "Password123#" `
            -Force `
            -AsPlainText



Export-PfxCertificate `
            -Cert $cert `
            -Password $MyPwd `
            -FilePath "C:\self-signed.pfx"

パラメータはこのへん

https://docs.microsoft.com/en-us/powershell/module/pkiclient/new-selfsignedcertificate?redirectedfrom=MSDN&view=win10-ps

管理者権限でないとダメみたい。(/・ω・)/

コメント

タイトルとURLをコピーしました