[英]productsign mac .pkg installer
I need to sign a MacOS installer with .pkg extension.我需要使用 .pkg 扩展名签署 MacOS 安装程序。 I have a .pfx certificate and added it to Keychain.
我有一个 .pfx 证书并将其添加到钥匙串。 It contains both certificate and the private key.
它包含证书和私钥。
But when I try to sign this .pkg using productsign
utility, it shows an error as :但是当我尝试使用
productsign
实用程序签署这个 .pkg 时,它显示一个错误:
productsign --sign "commonName" unsigned.pkg signed.pkg
productsign --sign "commonName" unsigned.pkg signed.pkg
productsign: error: Could not find appropriate signing identity for “commonName”.
productsign:错误:找不到“commonName”的适当签名标识。 An installer signing identity (not an application signing identity) is required for signing flat-style products.
签名平面产品需要安装程序签名身份(不是应用程序签名身份)。
These steps work for us:这些步骤对我们有用:
Unlock the keychain:解锁钥匙串:
security unlock-keychain -p {keychain_password} /Users/{your_user}/Library/Keychains/login.keychain-db
List the available signing identities:列出可用的签名身份:
Note: Code signing identities cannot be used to sign a pkg in mac.注意:代码签名身份不能用于在 mac 中对 pkg 进行签名。 You can find these by adding
-p codesigning
to the below command.您可以通过将
-p codesigning
添加到以下命令来找到这些。
security find-identity -v
Sign an installer using productsign:使用 productsign 为安装程序签名:
Note: The identity can typically be the long hex code from the above command:注意:标识通常可以是来自上述命令的长十六进制代码:
productsign --sign "{your_identity}" original.pkg signed.pkg
You have to find out what the name of your pfx is and replace the "commonName" with it.您必须找出 pfx 的名称并用它替换“commonName”。
U should search for something like "Developer ID Application: ..." to sign the package.您应该搜索诸如“开发者 ID 应用程序:...”之类的内容来对包进行签名。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.