Nuget パッケージ作成手順 - kkato233/DotNetZip.Semverd GitHub Wiki

パッケージ対象の EXE ファイルの署名

Visual Studio 2022 フォルダの中にある「Visual Studio 2022 Developer Command Prompt」で コマンドプロンプトを開く

signtool sign コマンドで 下記の DLL を電子署名する。

ListContents\bin\Release\netcoreapp2.0\DotNetZip.dll
Zip\bin\Release\DotNetZip.dll

nuget パッケージの作成

nuget.exe は 別途ダウンロードして PATH の通った場所に置いておく。

nuget.exe pack DotNetZip.1.16.1.nupkg

作成した nuget パッケージの電子署名

nuget sign DotNetZip.1.16.1.nupkg -Timestamper http://timestamp.comodoca.com/rfc3161 -CertificateFingerprint 「証明書のフィンガプリント」

nuget パッケージを github の パッケージに登録する。

https://github.com/settings/tokens のページへ行き write:packages 権限を持った personal access token (classic) を発行する。

dotnet nuget add source --username kkato233 --password 「上記で発行したパスワード」 --store-password-in-clear-text --name github_kkato233 "https://nuget.pkg.github.com/kkato233/index.json"

github nuget パッケージライブラリに公開

dotnet nuget push "DotNetZip.1.16.1.nupkg"  --api-key 「上記で発行したパスワード」 --source "github_kkato233"

パッケージセッティング の 下の方にある 「Danger Zone」 の中の「Change package visibility」をクリックして 「Public」に変更する。

これで、他の github ユーザも このパッケージを nuget 経由で ダウンロードする事ができる。

nuget パッケージの署名確認

nuget.exe verify -Signatures DotNetZip.1.16.1.nupkg

その結果

Signature Hash Algorithm: SHA256

Signature type: Author
Verifying the author primary signature with certificate:

  Subject Name: CN=K SYSTEM SOLUTION LLC., O=K SYSTEM SOLUTION LLC., S=Oita, C=JP
  SHA1 hash: 2517F768A3D29EF8C7820BB7625DBCFF40DB15C0
  SHA256 hash: A4D01ABF3D18F9FA2F3BDDC8C1CB39B129C97E48A3684C838DC89FF6139C2F64
  Issued by: CN=Sectigo Public Code Signing CA R36, O=Sectigo Limited, C=GB
  Valid from: 2024/03/14 9:00:00 to 2027/03/30 8:59:59
Timestamp: 2024/11/22 17:58:37

Verifying author primary signature's timestamp with timestamping service certificate:
  Subject Name: CN=Sectigo Public Time Stamping Signer R35, O=Sectigo Limited, S=Manchester, C=GB
  SHA1 hash: F8609819A6FB882CF7E85297F2A119521A16775F
  SHA256 hash: 628F3382FBC41070C3F68DD0E1836CDE5027AFF295F39FFB1D587DD3E0B949B7
  Issued by: CN=Sectigo Public Time Stamping CA R36, O=Sectigo Limited, C=GB
  Valid from: 2024/01/15 9:00:00 to 2035/04/15 8:59:59