署名と公証
各プラットフォームのパッケージに署名し、Windows のダウンロードに Authenticode 署名し、Mac アプリを公証する。
sign: identity: "Apple Development: you@example.com (ABCDE12345)" # signs the macOS app, else ad hoc profile: assets/AppStore.mobileprovision # signs the IPA keystore: assets/release.p12 # signs APKs, with key_alias certificate: assets/codesign.pfx # signs the Windows app and its installer # widgets_profile: assets/Widgets.mobileprovision # the iOS extension's profile; use a macOS profile for a Mac App Store build # share_profile: assets/Share.mobileprovision # signs the IPA's share extension # clip_profile: assets/Clip.mobileprovision # signs the IPA's App Clipキーストアのパスワードは NSGO_KEYSTORE_PASSWORD と NSGO_KEY_PASSWORD から取得します。-team は iPhone 用パッケージに署名します。-profile、-widgets-profile、-share-profile、-clip-profile、-macos-profile はコマンドラインからアプリ、ウィジェット拡張、Share 拡張、App Clip、Mac App Store 用のプロビジョニングプロファイルを上書きします。-installer は Mac Installer Distribution アイデンティティを上書きします。
Windows パッケージの署名
Section titled “Windows パッケージの署名”Authenticode は Windows ダウンロードの発行元を証明します(SmartScreen は評価を別途チェックします)。.pfx ファイルである sign.certificate は、実行ファイル、コマンドコンパニオン、アプリのリソースに含まれるプログラムやライブラリ、アンインストーラーを含むインストーラー、および Store チャンネル向けにビルドされた MSIX に署名します。パスワードは NSGO_CERTIFICATE_PASSWORD から取得します。署名は signtool と同等の形式で Go により生成されるため、Mac 上でも Windows SDK なしで署名できます。
sign: certificate: assets/codesign.pfx timestamp_url: http://timestamp.digicert.com # the RFC 3161 server that timestamps themsign.timestamp_url のデフォルトは DigiCert のサーバーであり、none を指定するとタイムスタンプなしになります(その場合、証明書の有効期限切れとともに署名も失効します)。ハードウェアトークンやクラウドサービス上の証明書を使う場合は、代わりに独自のコマンドで署名します。%1 が署名対象ファイルになり、ビルドは上記の各ファイルに対してこのコマンドを実行します。
sign: sign_command: "signtool sign /fd sha256 /tr http://timestamp.digicert.com /td sha256 /a %1"コマンドが成功したにもかかわらず、アプリ実行ファイル、コマンドコンパニオン、PE リソース、またはセットアップ実行ファイルに埋め込み Authenticode 署名が付いていない場合、build は停止します。
インストーラー内部のアンインストーラーは、埋め込まれる前に、アプリやセットアップと同じ sign.certificate または sign.sign_command で署名されます。-certificate、-sign-command、-timestamp-url を使ってコマンドラインからこれらを指定することもできます。
公証(Notarize)
Section titled “公証(Notarize)”Mac 向けにダウンロードされるアプリは、Apple による公証を受けることで Gatekeeper の警告なしに開けるようになります。Developer ID で署名し、notarytool がキーチェーンに保存する認証情報名を指定してください。
xcrun notarytool store-credentials hello --apple-id you@example.com --team-id ABCDE12345sign: identity: "Developer ID Application: Example Inc (ABCDE12345)" notarize: hello # the keychain profile above; or -notarize helloこれにより build は Hardened Runtime 付きで署名し、ディスクイメージを提出し、Apple の審査結果(数分程度)を待ってから、ディスクイメージとアプリにチケットをステープルします。却下された場合は Apple のログが出力されます。CI 環境では、プロファイルの代わりに App Store Connect API キーの .p8 ファイル、キー ID、Issuer ID である NSGO_NOTARY_KEY、NSGO_NOTARY_KEY_ID、NSGO_NOTARY_ISSUER を使用します。Hardened Runtime はアプリが宣言しない限りマイク、カメラ、カレンダー、位置情報へのアクセスを拒否しますが、apple.info に NSMicrophoneUsageDescription、NSCameraUsageDescription、カレンダーまたはリマインダーの利用説明、あるいは位置情報の利用説明が含まれている場合、build がこれらを自動的に許可します。