の作成方法を教えてください自己署名証明書コード署名Windowsの場合?

StackOverflow https://stackoverflow.com/questions/84847

  •  01-07-2019
  •  | 
  •  

質問

の作成方法を教えてください自己署名証明書コード署名を使用ツールからWindowsす。

役に立ちましたか?

解決

更新回答

ご利用の場合は、以下のWindowsのバージョン以降:Windows Server2012/日本語版、Windows Server2012R2、Windows8.1し MakeCertが推奨されていません, は、Microsoftの使用を推奨いたします のユー Cmdlet 新SelfSignedCertificate.

使用している場合は、古いバージョンなどのWindows7だっMakeCertう。一部の人 を提案公開鍵インフラストラクチャーユー(PSPKI)モジュール.

独自の回答

ることができますしながら、作成、自己署名コード署名証明書(SPC- ソフトウェアの出版社証明書)を一度もしなければならない。

の作成、自己署名証明書発行局(CA)

makecert -r -pe -n "CN=My CA" -ss CA -sr CurrentUser ^
         -a sha256 -cy authority -sky signature -sv MyCA.pvk MyCA.cer

(^=るバッチのコマンドラインへのラップライン)

この自己署名(-r)証明書、エクスポート可能な非公開キー(-pe).で"My CA"をする必要がありますし、自CAの店は、現在のユーザーです。我々の SHA-256 アルゴリズムです。の鍵は、署名(スカイ).

鍵の保管されるべきである。にMyCA.pvkファイルには証明書のMyCA.cerファイルです。

輸入のCA証明書

ありがとうございます。パスポートを持つCA証明書がない場合は信用しているわけではないだに取り込むことにより、Windows証明書店です。す ができ 使用の証明書MMC snapinからのコマンドライン:

certutil -user -addstore Root MyCA.cer

をコード署名証明書(SPC)

makecert -pe -n "CN=My SPC" -a sha256 -cy end ^
         -sky signature ^
         -ic MyCA.cer -iv MyCA.pvk ^
         -sv MySPC.pvk MySPC.cer

あとほとんど同じで、それだけでなく、提供する、発行体鍵と証明書(-ic-ivのスイッチ).

まも変換したい証明書をキーにPFXファイル:

pvk2pfx -pvk MySPC.pvk -spc MySPC.cer -pfx MySPC.pfx

したい場合は保護のためPFXファイルの追加-poスイッチ、その他PVK2PFXを作成しPFXファイルのないパスフレーズ.

使用証明書の署名コード

signtool sign /v /f MySPC.pfx ^
              /t http://timestamp.url MyExecutable.exe

(なぜタイムスタンプが事項)

インポートした場合のPFXファイルには証明書ストアを使用することができPVKIMPRTのMMC snapin),にお申し込みいただけますコードとして

signtool sign /v /n "Me" /s SPC ^
              /t http://timestamp.url MyExecutable.exe

可能なタイムスタンプのUrl signtool /t

  • http://timestamp.verisign.com/scripts/timstamp.dll
  • http://timestamp.globalsign.com/scripts/timstamp.dll
  • http://timestamp.comodoca.com/authenticode

全Microsoft文書

ダウンロード

される方いません。NET開発者が必要となりますので、コピーのWindows SDK。NET framework.現在のリンクで見ることができます: SDK&.当期純 (設置makecertに C:\Program Files\Microsoft SDKs\Windows\v7.1).燃費は変更になる場合がございます。

MakeCertは、Visual Studioコマンドを入力します。Visual Studio2015年なので、すでに発売スタートメニューからWindows7の下の"デベロッパー-コマンドプロンプトVS2015"または"VS2015x64ネイティブツールコマンドプロンプト"(おそらく全て同じフォルダ).

他のヒント

ロジャーとの回答があります。

私たちょっとしたトラブルを用いることは相当に骨の折れる仕事で、常に赤い窓かを確認する出版社の本ドライバソフトウェア"エラーダイアログを表示します。のキーをインストール試験ルート証明書

certutil -addstore Root Demo_CA.cer

るロジャーからの回答かったです。

こちらはバッチファイルがたまるのもったいなかったん.infファイルは含みません)。それはだから、GUIツールで 除数のパスワードを促).

REM Demo of signing a printer driver with a self-signed test certificate.
REM Run as administrator (else devcon won't be able to try installing the driver)
REM Use a single 'x' as the password for all certificates for simplicity.

PATH %PATH%;"c:\Program Files\Microsoft SDKs\Windows\v7.1\Bin";"c:\Program Files\Microsoft SDKs\Windows\v7.0\Bin";c:\WinDDK\7600.16385.1\bin\selfsign;c:\WinDDK\7600.16385.1\Tools\devcon\amd64

makecert -r -pe -n "CN=Demo_CA" -ss CA -sr CurrentUser ^
   -a sha256 -cy authority -sky signature ^
   -sv Demo_CA.pvk Demo_CA.cer

makecert -pe -n "CN=Demo_SPC" -a sha256 -cy end ^
   -sky signature ^
   -ic Demo_CA.cer -iv Demo_CA.pvk ^
   -sv Demo_SPC.pvk Demo_SPC.cer

pvk2pfx -pvk Demo_SPC.pvk -spc Demo_SPC.cer ^
   -pfx Demo_SPC.pfx ^
   -po x

inf2cat /drv:driver /os:XP_X86,Vista_X64,Vista_X86,7_X64,7_X86 /v

signtool sign /d "description" /du "www.yoyodyne.com" ^
   /f Demo_SPC.pfx ^
   /p x ^
   /v driver\demoprinter.cat

certutil -addstore Root Demo_CA.cer

rem Needs administrator. If this command works, the driver is properly signed.
devcon install driver\demoprinter.inf LPTENUM\Yoyodyne_IndustriesDemoPrinter_F84F

rem Now uninstall the test driver and certificate.
devcon remove driver\demoprinter.inf LPTENUM\Yoyodyne_IndustriesDemoPrinter_F84F

certutil -delstore Root Demo_CA

この答えを利用するためには、さらに非推奨されていませんの方にサイン独自のスクリプトは、使用 新SelfSignedCertificate.

  1. のキー:
    New-SelfSignedCertificate -DnsName email@yourdomain.com -Type CodeSigning -CertStoreLocation cert:\CurrentUser\My

  2. 輸出はなく証明書の鍵:
    Export-Certificate -Cert (Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert)[0] -FilePath code_signing.crt の[0]はこの作業場合には複数の証明書を...明らかにし、指数と一致したい証明書を使用---使用方法をろ過によるthumprintまたは発行体).

  3. インポートして信頼される出版社
    Import-Certificate -FilePath .\code_signing.crt -Cert Cert:\CurrentUser\TrustedPublisher

  4. インポートしているルート証明書ます。
    Import-Certificate -FilePath .\code_signing.crt -Cert Cert:\CurrentUser\Root

  5. サインを記述します。
    Set-AuthenticodeSignature .\script.ps1 -Certificate (Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert)

明らかい設定の鍵は、署名その他のスクリプトです。
ことができる詳細な情報および一部のブ助 この記事.

としてのユー4.0(Windows8.1/サーバー2012年 R2)することが可能で、証明書を窓なし makecert.exe.

のコマンドが必要 新SelfSignedCertificate輸出-PfxCertificate.

使 を自己署名証明書とユー.

で比較的容易に 新SelfSignedCertificate コマンドユー.オユびこれらの3つのコマンド.

1) 証明書の作成:
$cert=新-SelfSignedCertificate-DnsName www.yourwebsite.com 型CodeSigning-CertStoreLocation Cert:\CurrentUser\っ

2) パスワードを設定しま:
$CertPassword=ConvertTo-SecureString -文字列"my_passowrd"力AsPlainText

3) 輸出してい:
輸出-PfxCertificate-Cert"cert:\CurrentUser\っ\$($cert.Thumbprint)" -FilePath"d:\selfsigncert.pfx"パスワード$CertPassword

証明書 selfsigncert.pfx まあ@ D:/


オプションのステップ: いま必要な追加の証明書パスワードをシステム環境変数です。なを入力する以下のcmd: setx CSC_KEY_PASSWORD "my_password"

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top