iOS證書申請和使用詳解
WWDR將上述證書本身內容的使用哈希算法得到一個固定長度的信息摘要,然後使用自己的私鑰對該信息摘要加密生成數字簽名,整個過程如圖所示:
使用如下命令:codesign -s 'iPhone Developer: Yongjun Ma (5R2CR73PQ7)' TXChatParent.app
注: xx.app文件是xx.ipa文件修改擴展名,xx.ipa.zip解壓後包含的xx.app文件。
對已簽名app重新簽名為了重新設置簽名,你必須帶上 -f 參數,有了這個參數,codesign 會用你選擇的簽名替換掉已經存在的那一個:codesign -f -s 'iPhone Developer: Yongjun Ma (5R2CR73PQ7)' TXChatParent.app檢查已簽名的文件是否完整可以使用如下命令:
codesign --verify /Users/apple/genPackage/IOS_Parent/Payload/TXChatParent.app
就像大多數 UNIX 工具一樣,沒有任何輸出代表簽名是完好的。如果修改一下這個二進制文件:
和預料中的一樣,修改已經簽名的應用會導致數字簽名驗證不通過。
文件內容:描述文件主要包含以下內容:AppIDName teacherClient ApplicationIdentifierPrefix LB3ZWQKTZB CreationDate 2016-10-19T05:56:17Z Platform iOS DeveloperCertificates MIIF7TCCBNWgAwIBAgIIFRGPwAyLAEowDQYJKoZIhvcNAQELBQAwgZYxCzAJBgNVBAYTAlVTMRMwEQYDVQQKDApBcHBsZSBJbmMuMSwwKgYDVQQLDCNBcHBsZSBXb3JsZHdpZGUgRGV2ZWxvcGVyIFJlbGF0aW9uczFEMEIGA1UEAww7QXBwbGUgV29ybGR3aWRlIERldmVsb3BlciBSZWxhdGlvbnMgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTYxMDE3MTAzNzMyWhcNMTcxMDE3MTAzNzMyWjCB4DEaMBgGCgmSJomT8ixkAQEMCkxCM1pXUUtUWkIxYDBeBgNVBAMMV2lQaG9uZSBEaXN0cmlidXRpb246IEJlaWppbmcgWGllQ2hlbmdTaGFuZ0RlIEVkdWNhdGlvbiBUZWNobm9sb2d5IENvLixMdGQuIChMQjNaV1FLVFpCKTETMBEGA1UECwwKTEIzWldRS1RaQjE+MDwGA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1dGhvcml0eS8wDgYDVR0PAQH/BAQDAgeAMBYGA1UdJQEB/wQMMAoGCCsGAQUFBwMDMBMGCiqGSIb3Y2QGAQQBAf8EAgUAMA0GCSqGSIb3DQEBCwUAA4IBAQCl4zoK9y08sAM9IcG+RnXuDNXIjBQwtI3Qd4/V3zA7KOnmdxPfuE3ogK8cO8sMds0zNWn4gq5Zwi0Uqhc2uQNA82/gVRbQCCEKJ2XQxJfnySSg6/vZ8BVCg+kvB6QVqY4STiV9wTYFkNpDo7XIhoY+JHMAyVxmyINHJidB9wN7yox+xxnmuIM9NbzNGt2wgfIFEvPFHJfh8Jw/nmnR7W+RlPMm78bE4d1iTeyTvD9MsTbJyX4i8Bx+AnKqwo0LVVsMi/WePuKFVn9qlUBfH0jo1HJrpD4UwQ+9i0xLS79WOKpG7JbM4wRbkl7FQO1gw6/fKUfvdlm1VrJ2hVp/A2owEntitlements keychain-access-groups LB3ZWQKTZB.* get-task-allow application-identifier LB3ZWQKTZB.com.shangde.ps.teacher com.apple.security.application-groups com.apple.developer.team-identifier LB3ZWQKTZB aps-environment production beta-reports-active ExpirationDate 2017-10-17T10:37:32Z Name XC: com.shangde.ps.teacher TeamIdentifier LB3ZWQKTZB TeamName Beijing XieChengShangDe Education Technology Co.,Ltd. TimeToLive 363 UUID b95d2739-7ae4-4426-8bae-c83d2777a45b Version 1