You are trying to communicate with a server via a client app.
Transport Layer Security (TLS), formerly Secure Sockets Layer (SSL), is the standard for encrypting and authenticating messages and identifying users and servers. Using TLS, you can be sure that the Server to which you are connected is the one intended, that no one sees the contents of your messages, and that the Server can verify that the contents they received is the one that you sent.
So given that we have an iOS client app, the server side will provide you with a .crt file.
You will need a DER-encoded X.509 public certificate in your app. The first step is to convert the .crt file to the .der file. Download the .crt file onto your desktop like so:
loadhigh.crt
….
….
Rickys-MacBook-Pro:Desktop rickytsao$ openssl x509 -in loadhigh.crt -outform der -out “trusted_cert.der”
In our example, its called loadhigh.crt
Then run
1 |
openssl x509 -in loadhigh.crt -outform der -out "trusted_cert.der" |
to convert the crt file to der.
Then, put the .DER encoded certificate into the bundle.
How to create a bundle
Create a folder in finder
Add the .der file to the folder
Rename the folder so that its extension is .bundle (e.g. “New folder” -> “YonoAssets.bundle”)
PS: You can at any time right click the folder and hit “Show package content” in order to add, remove or modify any of the files. Drag it into you project
<3>How to use the bundle
1 2 3 |
NSString *bundlePath = [[NSBundle mainBundle] pathForResource:@"YonoAssets" ofType:@"bundle"]; NSBundle *bundle = [NSBundle bundleWithPath:bundlePath]; NSString *resource = [bundle pathForResource:@"fileName" ofType:@"fileType"]; |