Closed ogawa-ma closed 7 months ago
@ogawa-ma おそらく日本人だと思うので日本語で答えますが、つい先日自分もやってマニュアルを作ったので参考にしていただければ。 Sectigo(Comodo)から購入しましたがある程度、流用できるかと。
Sectigo(Comodo)の話なので、DigiCertだと別のやつ使ってるかもしれませんが、似たようなアプリはインストールしているはずです。 署名する際に USB ドングルと通信を行うためのソフトをインストールする。 リンク ちょっと分かりづらいが、下部にダウンロードリンクがある。
初期設定では署名する度にパスワードを入力することになるが、インストーラーやアンインストーラー含め署名する必要があるので、ビルドする度に毎回 6 ~ 8 回ほどパスワードを入力することになる。 あまりに面倒すぎるので上記インストールしたソフトのシングルログオンという機能を有効にする。
このソフトは常駐型のため Windows のタスクバーの右下の常駐アプリの所に「SafeNet Authentication Client」のアイコンもある。右クリックして「ツール」を選択すると設定画面が開く。
このページに画面写真付きで説明されているので従う。
ソフト記号後に[歯車]アイコン →Safenet→ ユーザー証明書 →【署名の名義】→ エクスポートのアイコンをクリック
MS のページからダウンロードする。
インストーラーでは後半、複数のツールのうち何を入れるか選択する画面があるが、「Windows SDK Signing Tools for Desktop Apps」 のみ選択して「Install」をクリックし完了。
(以下任意) 環境変数からユーザー環境変数の「Path」を編集。Windows タスクバーで「環境変数」で検索。 環境変数に「C:\Program Files (x86)\Windows Kits\10\App Certification Kit」を追加。
signtool を直接 shell で使う場合はファイルパスを指定できるが、electron-builder 任せにしたい場合は Windows に電子証明書をインストールする。
Windows に証明書ストアという機能があり、登録しておける。mac でいうところの keychain に相当する。
certmgr.msc
と入力electron-builder は自動で Windows の証明書ストアを検索するが、検索するキーワード(サブジェクト名)を登録する必要があり、確認する。
先ほど Windows の証明書ストアを開いたと思うが、該当の証明書を右クリックして「開く」とウィンドウが表示される。そこの「詳細」タブをクリックする。
サブジェクト名は書き方の規格があるが(CN=
みたいな書き方をしている部分)、electron-builder で設定する分にはCN
の値を控えるだけでよい。
先ほど控えたサブジェクト名を electron-builder の設定オブジェクトのwin
プロパティ内のcertificateSubjectName
プロパティに登録する。
// 例
win: {
// Windowsに証明書をインストールしておくと、この名義で検索して署名してくれる。当然ドングルは必要
certificateSubjectName: "【署名の名義(Subject名のCN)】"
},
正しく設定されており、USB ドングルが認識されているなら、途中で 1 回ぐらいは USB ドングルのパスワード入力画面が表示されるかもしれないが入力する。
インストーラーでもアプリ本体の Exe でもなんでもいいので、 右クリックして「プロパティ」をクリックすると、電子署名済の場合、「デジタル署名」というタブが表示されるので署名者やタイムスタンプを確認する。
@KaminoRyo 非常に丁寧なマニュアルを共有していただき、ありがとうございました。 教えていただいた手順に従って、署名が正常に行えることを確認いたしました。 この度は本当にありがとうございました。 問題が解決しましたので、こちらの件はクローズさせていただきます。
Hello,
Due to the limitations of machine translation, there may be inaccuracies in my expression. Apologies for any inconvenience caused.
I am currently utilizing the CSC_LINK and CSC_KEY_PASSWORD environment variables for EV code signing within my Electron application development process. As the validity period of my current certificate is nearing its end, I have contracted a new EV code signing certificate from DigiCert, which includes a USB hardware token for the signing process.
With this transition to using a USB for signing, I am wondering if it's possible to maintain the automation of the signing process as with the previous method. Specifically, is there a way to integrate the USB hardware token signing into electron-builder’s build process to automatically sign the application during the build?
Additionally, if integrating the signing process with electron-builder proves challenging, I am considering manually signing the application using SignTool.exe. In our existing build process, both the generated .exe file and the executables within .7z archives were signed. If proceeding with manual signing, is it necessary to sign both the .exe file and the executables inside the .7z archives?
Thank you for your time and assistance. I look forward to any guidance or suggestions you can provide.