0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

UnityのBuild Automationで、公証に失敗する

Posted at

はじめに

こんにちは、ユーゴです。今回は、Unity CloudのBuild Automationを使用した時に遭遇した問題を紹介します。

問題

以下のように、Apple Developerの公証まわりでエラーが起きる。

Notarization Certificate Missing

If your macOS notarization fails, ensure your .p12 certificate was exported correctly with all required intermediary certificates. When exporting your Developer ID certificate from Keychain Access, make sure to also select the 'Apple Worldwide Developer Relations Certification Authority' certificate. After re-exporting your .p12 with the complete chain, re-sign your application and attempt notarization again. You can verify your certificate chain in Keychain Access by inspecting your Developer ID certificate.

解決

証明書(.cer) + 秘密鍵(.key) + G2証明書(.cer)を、p12としてパッケージングする

1. G2証明書を取得

まず、G2証明書をダウンロードします。(ダウンロードリンクなので注意)
ダウンロード:Developer ID - G2

補足で、G2証明書を含む公式の証明書は、以下から取得できます。
Apple PKI

2. p12を取得

前提、opensslコマンドが入っている想定です。opensslをインストールしたのに使えない方は、多分パスが通ってないです。
ChatGPTに聞いて直すか、フルパス指定(コマンド冒頭のopensslC:\Program Files\OpenSSL-Win64\bin\openssl.exeなどに置き換え)で回避してください。

Windows
openssl pkcs12 -export `
  -inkey あなたの秘密鍵.key `
  -in あなたの証明書.pem `
  -certfile DeveloperIDG2CA.cer `
  -out 保存ファイル名.p12
Mac, Linux
openssl pkcs12 -export \
  -inkey あなたの秘密鍵.key \
  -in あなたの証明書.pem \
  -certfile DeveloperIDG2CA.cer \
  -out 保存ファイル名.p12

うまくいかない時

  • 「Enter Password」の時は、画面にキー入力が反映されないが、認識はされていることを理解しているか?
  • opensslのコマンドが、PATHに含まれているか?
  • カレントディレクトリに、証明書 + 秘密鍵 + G2証明書があるか?
  • ファイル名は合っているか?
    • バージョンによって「DeveloperIDG2CA.cer」の名前が変わるかもなので、手順1でダウンロードしたファイルの名前に置き換えてください

3. Build Automationに設定

p12のアップロード、パスワード設定などを行なってください。
ここはおそらく分かる想定なので、詳細を省略。

参考

[Action required] Notarization fails because Cloud Build is missing required certificate

余談

今回は要件として「Windowsでセットアップ作業ができること」とのことで、MacのKeychainが使えないなど、通常よりも困難な道のりでした。
本来は、Keychainなどでうまい具合に認証をやってくれると思います。

まとめ

いかがだったでしょうか。今回は、Unity CloudのBuild Automationで公証に失敗するときは、G2証明書を使用すると解決できる、というご紹介でした。

このように、Unityをテーマにしたり、AWS, 量子コンピューティングなどをテーマに記事を書いたり、幅広い内容を取り扱っております。
お役に立てましたら、いいね・フォローなど、よろしくお願いします!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?