Apple App develop the signature

If your Apple ID account (using the email can be registered ) for the Apple developer type, then log on after not see Certificates, Indentifiers & Profiles information

Apple developer account is the most basic type, mainly used in the App Store to download a variety of applications (including xCode SDK and other development tools and libraries) and on the iCloud backup files and photos

After clicking through the bottom of the "Joining the Developer Program" link and follow the guidelines click the button to enroll, pay 99 $ / year, to become registered Apple developer

At this point you can see the Certificates, IDs & Profiles button, then click on it to enter Certificates, Indentifiers & Profiles panel of

 

Certificate (Certificate)

Certificates (Certificate) is a file that contains information about the owner of the public key and the public key of a signed by a certificate authority digital

Used to used to sign the application (Signature), and only after signature of the application to ensure it is trusted sources, and the code is complete, unmodified

Certificates generally have timeliness, it is only valid for a specific period of time.

 

Apple's Certificate Development and Distribution is divided into two kinds. Development certificate for developing and debugging applications, can be used for device debugging; Distribution certificate for package upload App Store, developers used to verify the identity of

Certificates are listed in the list of certificate (.cer file) is the public key certificate if the certificate is generated on others machines, installed on the machine is not its matching private key

Note: Keychain Access (Keychain Access) in the application \ Utility (Applications \ Utilities) in

你可以在自己的机器上创建一个与本机私钥相匹配的公钥证书(.cer文件)

方法1:

(1)选择证书分类,在钥匙串访问(Keychain Access)菜单:“钥匙串访问” -- “证书助理” -- “从证书颁发机构请求证书”

         用户电子邮件地址和CA电子邮件地址可以随便输入一个邮箱,常见名称为密钥的名称,点击继续后会从苹果官方CA(Certificate Authority,证书授权中心)获取得到一个证书请求文件(.certSigningRequest文件)

注:生成certSigningRequest文件过程中,实际上是生成了一对公钥和私钥(Key Pair),保存在你Mac的keychain中。代码签名正是使用这种基于非对称秘钥的加密方式,用私钥进行签名,用公钥进行验证。

如下图所示,在你Mac的keychain的login中存储着相关的公钥和私钥,而证书中包含了公钥。你只能用私钥来进行签名,所以如果没有了私钥,就意味着你不能进行签名了,所以就无法使用这个证书了,此时你只能revoke(删除)之前的证书再申请一个。

因此在申请完证书时,最好导出并保存好你的私钥。当你想与其他人或其他设备共享证书时,把私钥传给它就可以了。私钥保存在你的Mac中,而苹果生成的Certificate中包含了公钥。

当你用自己的私钥对代码签名后,苹果就可以用证书中的公钥来进行验证,确保是你对代码进行了签名,而不是别人冒充你,同时也确保代码的完整性等

(2)在页面上点击“+”创建一个新证书,选择证书类型后,需要上传第一步中的certSigningRequest文件,来生成与本机私钥相匹配的公钥证书(.cer文件)

(3)下载.cer文件,双击或将其拖入钥匙串访问(Keychain Access)中进行安装,结果如下

注:左边有个三角形箭头的证书是可以点开看到专用密钥(private key),这种证书才能用来签名应用程序

方法2:

在菜单Xcode -- “Preferences”的Accounts标签页中,登录Apple ID账号后,也可以看到账号下的证书列表

点击左下角的+号可以创建并安装一个有私钥的证书

注1:点击左下角的+号来创建安装一个证书时,才会刷新XCode这个证书列表(应该是一个bug)

注2:灰色(Stauts:Not in Keychain)为没有安装到钥匙串访问(Keychain Access)的证书

         图标上带个x(Status:Missing Private Key)为安装到钥匙串访问(Keychain Access)但在本机找不到私钥相匹配的公钥证书

         正常图标为安装到钥匙串访问(Keychain Access)且本机有私钥相匹配的证书

 

从钥匙串访问(Keychain Access)将含有私钥的证书导出(.p12文件)给其他mac机器使用

(1)选中证书私钥,右键菜单选择“导出xxx...”,选择保存路径

(2)会弹出一个框,要求填入一个对p12文件加密密码(也可以不填)

(3)最后,钥匙串访问(Keychain Access)会要求输入当前账号密码来授权输出p12证书文件

 

在mac上, 双击证书(.p12文件)或将证书拖入到钥匙串访问(Keychain Access)即可完成证书的安装

 

在windows上,导入的iOS证书会保存到证书管理器(certmgr.msc)中   

注1:可在管理器中选中对应证书进行删除

注2:含有私钥的证书的左上角有一个钥匙的小图标

UE4使用IPhonePackager.exechs)工具来在windows上安装iOS证书,命令如下:

"D:/UnrealEngine/Engine/Binaries/DotNET/IOS/IPhonePackager.exe" Install Engine -project "D:/svn/TPSProject/TPSProject.uproject" -certificate "D:/txjsj_dev.p12" -bundlename "com.ten.DGame"

如果有证书的pp文件,可以从证书管理器中导出p12格式的iOS证书,命令如下:

"D:/UnrealEngine/Engine/Binaries/DotNET/IOS/IPhonePackager.exe" ExportCertificate "D:/svn/TPSProject/TPSProject.uproject" "D:/DGame.mobileprovision" -outputcertificate "D:/mycertificate.p12"

注:生成出来的mycertificate.p12的密码(在UnrealEngine\Engine\Source\Programs\IOS\iPhonePackager\CompileTime.cs的ExportCertificate函数中写死)为:A

扩展阅读:udn:iPhonePackager Tool中文

UE4会在“平台” -- “iOS”中列出当前机器上安装的所有的iOS证书和PP文件

勾选某个证书和PP文件后,会将选中的证书和PP文件的名称记录在DefaultEngine.ini中

[/Script/IOSRuntimeSettings.IOSRuntimeSettings]
MinimumiOSVersion=IOS_10
bSupportsPortraitOrientation=False
bSupportsUpsideDownOrientation=False
bSupportsLandscapeLeftOrientation=True
PreferredLandscapeOrientation=LandscapeLeft
MobileProvision=DGame.mobileprovision
BundleIdentifier=com.ten.DGame
SigningCertificate=iPhone Developer: cert RDM (CFG5EWN5ME)

 

App ID

App ID用于标识一个或者一组应用程序,App ID需要与应用程序的Bundle ID是一致的或者匹配的

App ID主要有以下两种:
Explicit App ID:唯一的App ID,这种App ID用于唯一标识一个应用程序,例如com.ten.DGame,标识Bundle ID为com.ten.DGame的程序
Wildcard App ID:通配符App ID,用于标识一组应用程序。如:*可表示所有应用程序,com.*可表示以com.开头的所有应用程序,com.ten.*可表示以com.ten开头的所有应用程序

 

Device(设备)

Devices即设备, Devices中包含了该账户中所有可用的设备。 每台设备使用UDID(形如:0f3f1a4430543305f21f17cb49d0c0f3f1a44305,由40个16进制数字组成的字符串,共160 bits)来唯一标识

每个账户中的设备数量限制是100个,Disable一台设备也不会增加名额,只能在membership year开始的时候才能通过删除设备来增加名额。详见:关于iOS测试机个数上限的详细规则

查看设备UDID

方法1:

(1)将手机通过数据线查到电脑,并在手机上信任此电脑后,就可以在iTune中查看手机的UDID

(2)如下可以看到当前手机的UDID(注:如显示为序列号、ECID、型号识别符等,请点击切换到UDID)

方法2:将手机通过数据线查到电脑,并在手机上信任此电脑后,在Xcode菜单“Window” -- “Devices and Simulators”的Devices面板中查看手机的UDID

 

Provisioning Profiles(PP文件) 

Profiles即为Provisioning Profiles文件(后缀名为.mobileprovision),简称PP文件

PP文件包含了上述的所有内容:证书、App ID、设备,决定应用程序能在那些设备上运行

注1:PP文件也分为Development和Distribution两种,必须与证书相对应

        即Development的PP文件要使用Development的证书,Distribution的PP文件要使用Distribution的证书

注2:Development的PP文件才允许使用xCode进行调试

注3:PP文件可以关联多张证书,多个设备

注4:Distribution类型的PP文件又分为In House(配合企业证书使用,没有设备限制)、Ad Hoc(只能运行在该账户内已登记的可用设备上,最多100个设备)、App Store(上架App Store用,没有设备限制)

 

在打包或者在真机上运行一个应用程序,我们首先需要证书来进行签名,用来标识这个应用程序是合法的、安全的、完整的等等;

然后需要指明它的App ID,并且验证Bundle ID是否与其一致;再次,如果是真机调试,需要确认这台设备能否用来运行程序。

PP文件把这些信息全部打包在一起,方便我们在调试和发布程序打包时使用,这样我们只要在不同的情况下选择不同的profile文件就可以了

PP文件会在打包时嵌入.ipa的包里(即名为embedded.mobileprovision的文件)

在一台设备上启动应用程序时,会用PP文件进行如下校验:

 

Mac机器上PP文件的安装目录为:/Users/<用户名>/Library/MobileDevice/Provisioning Profiles

中文路径为:/用户/<用户名>/资源库/MobileDevice/Provisioning Profiles

注:该目录在Finder中不可见,可通过菜单“前往” -- “前往文件夹...”来打开

       或者在Terminal终端中查看  cd ~/Library/MobileDevice/Provisioning\ Profiles

注1:上图中mobileprovision文件名中的UUID是从mobileprovision文本文件中读取的

<key>UUID</key>
<string>672e56b7-d5e2-45a2-acc8-00f6cde47063</string>

注2:mobileprovision文件原始的文件名也存储在mobileprovision文本文件中

<key>Name</key>
<string>PP20190723_1120</string>

注3:可以从Xcode中将Apple ID账号中的PP文件同步到本地

在windows上,PP文件安装目录为:%homepath%\Appdata\Local\Apple Computer\MobileDevice\Provisioning Profiles

 

在Xcode中开发应用时,可以从项目工程中设置其使用的PP文件,让其对ipa文件进行签名输出(CodeSign)

注1:点击Provisioning Profile后面的上下箭头,会弹出快捷菜单

Import Profile:可导入本地的一个PP文件到PP文件的安装目录

Download Profile:若在Xcode中登录了Apple ID账号,会列出账号中拥有的PP文件

注2:也可以勾选“Automatically manage signing”,让Xcode来自动管理

 

Keys(extra service)

 Keys定义了开启了那些Service,如上DGame该值为2,代表开启了Apple Push Notifications service (APNs)和DeviceCheck服务

Apple Push Notifications service (APNs)
Establish connectivity between your notification server and the Apple Push Notification service. One key is used for all of your apps. 
DeviceCheck
Access per-device, per-developer data that your associated server can use in its business logic. One key is used for all of your apps. 

 

其他

Xcode中共享developerprofile来共享Apple ID账号

(1)在Xcode登录Apple ID账号,点击左下角螺母图标,弹出快捷菜单“Export Apple ID and Code Signing Assets”输入保护密码后,就可导出开发者账号(*.developerprofile)

(2)在其他机器上对应位置的快捷菜单“Import Apple ID and Code Signing Assets”输入保护密码来导入该文件

注:developerprofile文件实际为一个zip文件,改后缀解压后,里面文件列表如下:

 

参考

How to Submit An App to Apple: From No Account to App Store Part1

How to Submit An App to Apple: From No Account to App Store Part2

关于Certificate、Provisioning Profile、App ID的介绍及其之间的关系

iOS App 签名的原理 

 

Guess you like

Origin www.cnblogs.com/kekec/p/11182924.html