Explanation of IOS certificate and signature [transfer]

Source: Internet
Author: User
Tags reverse dns

Tutorial:

 

The following is an article provided by a full-time IOS developer in Melbourne, Australia.Article. He was a very modern young man-Adam eberbach on the forum.

· Bundle identifier

· Provisioning profiles

· App ID

· Certificate Signing Request

It is really difficult for new users to figure out the differences between these things.

Next we will unveil their mysteries. After reading this article, you should be able to associate these things and understand how they work, and can smoothly run your application on the device.

 

Of course, assume that you are already an iOS developer, have IDP, and have some experience in xcode and iOS development. If you are just learning iOS, you can take a look at other tutorials.

 

Okay, let's get started.

 

How important are they?

The main significance of code signing for you is that it allows your app to run on the device. Whether it's your own device, Party A's customer, or your consumer on the app store.

 

Without code signing, you can only run your application on a simulator or a jailbroken machine-of course, this alone cannot satisfy us.

 

The simulator test is only a preliminary test. The simulator cannot replace the real machine debugging because:

· Real devices are usually slower than Simulators

The simulator uses the processor on your Mac, and a real iPhone is far from that. Therefore, if you are not running on the device, you may ignore the actual performance problems.

For example, you create a viewbased application and add the following content to viewdidload:Code:

 

 
Int COUNT = 200000;
Nsmutablearray * array = [nsmutablearray arraywithcapacity: Count];
For (INT I = 0; I <count; ++ I ){
[Array addobject: [nsstring stringwithformat: @ "% d", I];
}

 

The above code may run in 1-2 seconds on the simulator, but it takes about 7 seconds on the real machine (such as the iPhone 3gs.

 

· The device memory is much less

Similarly, the simulator uses the memory on your Mac, while a real iPhone has much less memory.

In particular, games usually use a large number of images and occupy a large amount of memory. On older models, the maximum size of a texture image is 24 MB, that is, the 8bit texture image of X.

Memory depletion is definitely something you don't want to see, because the memory occupied exceeds a certain range, and the OS will forcibly exit your app. for users, it is considered that your app has crashed.

 

· Some APIsValid only on devices

For example, the in-APP purchase API or the core animation in the instrument. These must be tested on a real machine. (It may be supported by later versions of IOS or xcode, but real-machine testing is a guarantee after all)

In general, if you haven't tested it on a real machine, it means you haven't completed the test.

· (NOTE: Some visual effects may be different from those seen on the simulator)

 

There are some lazy methods in xcode:

On the organizer page, right-click devices and select developer profile. You can see this menu.

It contains most of the content to be discussed in this article.

 

 

Here you can sign in your developer account, automatically register your app and run it on your device.

Of course, this article will be meaningless if it is always easy to use.

As a developer, You should know more.

 

Public and private keys Public Key Private Key

Before proceeding to the analysis, we should simply parse the public key and private key.

There are two types of encryption methods in this world: symmetric ric cryptography symmetric password and asypolicric cryptography asymmetric password.

A symmetric password has only one key. For example, you have a key and a corresponding encrypted information.

Only those who know the key can interpret the information.

 

For asymmetric passwords, there are two key-Public and private keys.

For example, if you use a private key to encrypt some information, you can use the public key corresponding to the private key to encrypt the information. In this way, they can be sure that this information is from you (at least encrypted ).

This private key is equivalent to a "signature ". (The password you added is the word you signed)

 

This is the principle behind code signing in IOS.

 

Code signing objects

Something related to code signing:

Provisioning profiles, app IDs, udids...

In this section, we will explain it one by one.

 

I drew a chart using core data to describe the relationships between these objects.

 

 

This is for developers (Development Profile). There is a small difference in the diagram of publishers.

 

 

Private Key:

After Mac OS X, keys are managed by an app called keychain. You can find it in Application \ utilities.

Run the keychain command to view the public and private keys under your account. Similar to this:

 

 

(This is private and requires code)

 

Don't worry if you don't see any key list. The keychain will help you create your first authentication.

 

The keys listed here are the basis of your provisioning or code signing.

You must have a key to sign the Code or publish your app in the app store.

 

If the key is lost?

You must redo the entire process-Your authentication is no longer valid because there is no key, and your provisioning profile will only generate an error. You will waste a lot of time, so keep it safe.

 

If you have not backed up any data, we recommend that you immediately export it and store it in a safe place through file \ export items, such as a small partition. Or you can use your Mobile Me account to save data synchronously.

 

There are multiple keys?

If you have created accounts on different MAC machines, you will have multiple keys.

This will cause a problem. The authentication generated on machine A will fail on machine B without the private key.

 

Therefore, you can copy all your keys to all your Mac servers. (This will be annoying)

Or, I suggest using only one key.

 

Udid

Udid (unique device identifier) is the unique identifier used to distinguish physical devices.

All your iPhone must have a distinctive udid, including your iPad.

Generally, udid is a 40-bit hexadecimal string.

That is, identifier:

 

 

If the app is not from the App Store, your code must have a udid to run.

 

How do I know the udid of your device? There are several methods.

1. If your device is connected to the xcode machine, you can see the udid in organizer.

 

2. If you do not have xcode, you can click serial number on the summary page of iTunes.

 

 

 

3. This is the simplest method. Download an ad hoc helper in the app store.

 

Certificate Certification

Authentication is your individual developer authentication, or more brilliantly: "apple worldwide developer relations certification authority certificate" (this is not translated ),

This is essentially the data that represents trust-authorization.

To obtain an authentication, You need to generate a Certificate Signing Request in the key chain access and send it to Apple. This creates a pair of Public Key-private key (if not ).

After Apple receives the verification message, it creates an authentication for you.

 

APP ID

Create a project in xcode4 and provide the product name and company identifier information.

Product Name is a short name of your app.

Company identifier is usually a reverse DNS string, for example: COM. mycompanyname

The combination of the two seems to bundle identifier. You will find it in info. plist.

For every app you want to publish, You need to register your app ID in the iTunes Developer Center. For example.

 

This must be consistent with what you set in info. plist.

Provisioning Profile

Combine the things mentioned above:

· App ID (Unique id of an app)

· Udid (unique identifier for running on a device)

· Certificate (developer authentication)

Is the so-called provisioning profile.

 

Provisioning profile is imported to the device through xcode or iTunes, or packaged into A. IPA file containing the app and profile.

 

You can create your provisioning profile in the IOS provisioning portal.

 

 

To create a new instance, follow these steps:

· Name the profile. You will see it later in xcode's organizer, buid settings, and other places.

· Select your certificate

· Select your app ID, which must be consistent in info. plist.

· Select the device to be applied. Generally, I select all my devices.

 

Personal use signature signing

Suppose you already have an app for testing, and you have an IDP, And you have handled the provisioning profile.

Now you know their logic clearly. If you join, you need to do the following:

1. Check your public key and private key for future convenience.

2. Use keychain access to create your development authentication. Then download the authentication that Apple gave you, double-click the installation, and you can see it in the keychain.

3. Download "apple worldwide developer relations certification authority certificate" (WWDR) and double-click it to install it. You can also see it in the keychain.

4. Check the bundle ID of your project and create a consistent app ID in the provisioning portal.

5. Add the desired udid to the provisioning portal. (ALL added)

6. Create a provisioning profile for your certificate and specify your app ID and udid.

7. Download the created profile and drag it to your xcode organizer.

 

Then, you can sign your project and run it on your device.

In target-build settings, scroll down to the code signing section.

 

Try to edit the debug schema, which is suitable for team collaboration:

Select "iPhone developer" in automatic profileselector, and you will see that your authentication has been automatically selected.

 

Everything is done. connect to your device and select debug build, build & run in xcode.

Xcode will install the provisioning profile on your device and run your app.

 

Address: http://www.cnblogs.com/andyque/archive/2011/08/30/2159086.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.