How to convert .p12 file to .pem file using Terminal? - iphone

I already have an development certificate in apple developer portal. Am developing an iPhone app,i want to integrate Apple Push Notification in this app. I have created a new App ID with used the existing certificate and enabled the Push Notification in this app id. And i have created a new Provisioning Profile used the newly created app id. Before these steps i have created and downloaded the .cer file from keychain access. After done these steps i downloaded the newly created SSL (Apple Push Notification Service SSL certificate) file and installed in my Mac Keychain Access. Once i installed this file, verified (Green tick mark is there) and got the .p12 file from this ssl file.
I followed the apple document RemoteNotificationsPG.pdf, in this document they mentioned after saved the .p12 file open the Terminal app and type below commends,
openssl pkcs12 -in Certificates.p12 -out Certificates.pem -nodes
I have used this in my Terminal app, but the error message is appear that is,
Error opening input file Certificates.p12
Certificates.p12: No such file or directory
Can you please suggest or guide me where i did wrong or what i missed in these steps? Please help me. Thanks in advance.
EDIT:
I stored my Certificates.p12 file in my desktop. Folder path is Desktop->1/5/2012_Certificate->2/5/12->Certificates.p12
I have used 'ls' command in Terminal it is not listing my Certificates.p12 file.
I have typed cd *path* this returned No such file or directory.
Please help me. Thanks in advance.

Are you in the right directory? Use ls command, does it list Certificates.p12?
EDIT: In the terminal type:
ls
this will list all the files of the current directory that you are in. If Certificates.p12 is not listed, you are not in the correct directory in the terminal.
To get to the correct directory type:
cd *path*
where path is the folder containing Certificates.p12. You can drag and drop that folder into the terminal after typing cd. Hit return. Then run the openssl command.

Open the terminal and click ls to list the items in the current directory,
then if you are not in the folder in which the .p12 is having move to the correct directory by
cd directory path
for example,
cd Downloads
Then list the files using and make sure the .p12 file are existing in the directory.
Then convert the .p12 file to .pem file using the following command.
openssl pkcs12 -in filename.p12 -out filename.pem -nodes
The .pem file which you have created will be saved in the directory which is having the .p12 file.

Related

Keystore Explorer 5.1.1 Could not open certificate file CRT(that already signed by organization)

I created a CSR file via Keystore Explorer5.1.1 and sent the CSR to authority organization. The organization returned me certificated CRT file and I got the CRT to Examine by Keystore Explorer, which reported an error:
Version 5.1.1 is more than two years old and it had some problems with PEM encoded certificate files. A newer version of KeyStore Explorer could probably open this file.
But this is not the right way to import the certificate from the CA anyway. Instead follow these steps:
Open the keystore with the key pair.
Right click on the key and select "Import CA Reply"
Select the certificate file.

Is there a way to view your app's .entitlements file from your app's .ipa archive?

I think there's an issue with my app's .entitlements file when a .ipa is created and so I want to check the Bundle ID of the entitlements file. There's a fairly complicated build script I am using to change some stuff in there before building so I want to see what the final product is. I know that there used to be an Entitlements.plist that I could get off of the ipa but it doesn't seem to be there any longer. Is there any way to access the .entitlements file now?
For those getting here via Google, the Information Apple provides at https://developer.apple.com/library/ios/qa/qa1798/_index.html is a lot more recent.
Specifially, after unzipping the IPA:
Display the entitlements in the app by running:
codesign -d --entitlements :- "Payload/YourApp.app"
and display the provisioning profile by running:
security -D -i "Payload/YourApp.app/embedded.mobileprovision"
Sure, unzip the .ipa file which will create a Payload directory. Inside of the Payload directory is the application package. Right-click the app package in Finder to "Show Package Contents".
Look for the embedded.mobileprovision file which you can open with a text editor or plist editor. Look for the <key>Entitlements</key>

How can I edit Root.Plist inside a generated .ipa archive?

The case is as follow , I have developed an iphone application and want to brand it without giving the source code for the client (whom by themselves refuses to give me the credentials for their developer accounts) , so I was thinking , is their any way to give them the .ipa file and enable them to change a couple of images and the Setting.bundle , re-codesign it and submit it on thier own ??
It was solved as follow,
Rename the ".ipa" file to a .zip and extract it
Go to Payload/{your app}.app , right click on it and show package content if you are running MacOSX , windows will see it as folder
change what you want from images and Settings.bundle ...etc.
Resign the code through the shell as indicated in the attached .sh file
#!/bin/sh
#Given that the application name is MyApplication.ipa
export ARCHIVE_NAME="MyApplication"
#As indicated in the keychain certifcate common name
export CERTFICATE_NAME="MyCertificate"
rm -rf ./Payload
echo "$ARCHIVE_NAME"".ipa" "$ARCHIVE_NAME"".backup"
unzip "$ARCHIVE_NAME"".ipa"
codesign -f -s "$CERTFICATE_NAME" ./Payload/"The package name in the Payload folder with the extension"
zip -r ./"$ARCHIVE_NAME"".zip" ./Payload
cp "$ARCHIVE_NAME"".ipa" "$ARCHIVE_NAME"".backup"
mv "$ARCHIVE_NAME"".zip" "$ARCHIVE_NAME"".ipa"
rm -rf ./Payload
echo "Finished Code Sign successfully"
The tricky part was , how to upload the archive once again to the store ?
A tool offered by apple through the itunes-connect account should be used to upload that archive independent from Xcode.
it could be found as follow itunes-connect -> login -> manage your application , the second left bottom tab is for the application loader "Hidden in a smart way , Apple is Apple :)"

How to Import Reconfigured apk File from Amazon Appstore into Eclipse for Signing

Amazon App Store (appstore) - Marketplace requires you to upload unsigned apk files. They then reconfigure and add their own coding. They then ask you to download that reconfigured file, sign it, then re-upload it to their site.
I'm having a heck of a time trying to import that reconfigured file into Eclipse for signing. Do I use the IMPORT option? If so, what specific steps? Or do I use the Terminal to sign?
I tried importing the new file the same way I imported my original project (using Wizard: Android>Android Project...) but that won't work for the new file.
Any suggestions or workarounds would be appreciated.
PS I found a great site that helps with eclipse and installing apks. But it didn't answer this question.
http://www.satyakomatineni.com/akc/display?url=displaynoteimpurl&ownerUserId=satya&reportId=3279
The ADT plugins for Eclipse can't import an APK to sign it, they can only export a signed (or unsigned) APK. But these instructions from the Android Developers site should help you get on your way: http://developer.android.com/guide/publishing/app-signing.html#signapp
You don't need to import the .apk file back into Eclipse, but can sign it from command line. In fact, Eclipse invokes this same procedure behind the scenes when it signs your binary.
In the samples below, replace the AppName with your application's name. The first step (to generate the keystore file) you will do only once when you setup your project, and the other 2 steps -- every time you need to sign the app. I hope that answers your question.
:: Generate a keystore file
cd "c:\Program Files (x86)\Java\jdk1.6.0_21\bin"
keytool.exe -genkey -v -keystore AppName.keystore -alias AppName -keyalg RSA -keysize 2048 -validity 10000
:: Sign the .apk file
cd "c:\Program Files\Java\jdk1.6.0_29\bin"
jarsigner.exe" -keystore AppName.keystore AppName.apk AppName
:: Zip align the .apk file and copy it to the install folder
cd "c:\Program Files (x86)\android\android-sdk\tools"
zipalign.exe" -f -v 4 AppName.apk install\AppName.apk

Create .ipa for iPhone

I developed one application for iPhone. After I build I got .app file in build folder.
My application name is Myapp, then i got Myapp.app file in the build folder.
My problem is i want to create the .ipa file. how is that.. it is for to install
jailbraked iPhone..
Create a folder named Payload.
Copy Myapp.app (from products of your project) into the Payload directory.
Right click and Compress the Payload directory.
Rename the zip file to Myapp.ipa.
** Update ** This answer is very old. Use Xcode to build .ipa archives now. (Product > Archive)
Run Script
/bin/sh
mkdir $CONFIGURATION_BUILD_DIR/Payload
cp -R $CONFIGURATION_BUILD_DIR/$PRODUCT_NAME.app $CONFIGURATION_BUILD_DIR/Payload
cp $CONFIGURATION_BUILD_DIR/$PRODUCT_NAME.app/iTunesArtwork $CONFIGURATION_BUILD_DIR
cd $CONFIGURATION_BUILD_DIR
/usr/bin/zip -r $PRODUCT_NAME.ipa Payload iTunesArtwork
rm -rf Payload iTunesArtwork
exit 0
With Xcode 4, there is now a way more easy way:
In the menu bar, go to Product > Archive.
The organizer will then open in the Archives tab, and you will be able to save an IPA using the Share… button.
If the Archive menu item is disabled, make sure you have the scheme set to iOS device and not the iPhone Simulator. You don't have to have a device plugged in, though.
I also wrote a script to do this from the command line: xcodearchive. It works similar to xcodebuild, but generates an IPA.
Signing Part:
This part is required for non-jailbroken phone and rest of the steps are same
Open Terminal and enter the following commands
codesign -f -s "Code signing certificate name" appNamewithextension
example
codesign -f -s "iPhone Developer: Durai Amuthan" sample.app
Verify it is signed using the following command
codesign -verify AbsolutePath_with_app_name
ipa creation Part:
Way 1:
1.Create a folder named Payload and copy the .app into it
2.compress it and you'll get Payload.zip
3.Now Change the extension from zip to ipa that's it
mkdir Payload
cp -R MyAppName.app Payload/
zip -r -s 64 Payload.zip Payload/
mv Payload.zip MyAppName.ipa
Way 2:
Drag and drop the .app in iTunes that'll create the iPa for you
Installation part:
If you had Tried the Way 1 in previous step then Drag and drop the .ipa in iTunes
Choose the device in iTunes and click install and apply the sync that's it
Follow the following steps
Upload your app file as a zip on www.diawi.com
Open the diawi url in your web browser.
You will find download application option there. Download the file and it will be downloaded as an IPA.
Also, if you want to include the logo file, add the icon to the directory and name it "iTunesArtwork". compress that along with the Payload directory that has the .app file in it.