I could Generate PKCS1 formatted raw signature.. and was able to verify it even.
But could not find the resource to generate PCKS7 Formatted Signature using IPHONE IOS SDK.
I need to sign a simple text message.
Which library I have to use?
Can we use openssl for this? if yes? then how to include it in the XCODE library framework?
Pls help out.
Yes you can use openssl for this, however you will need to compile it yourself and link your App against the static library. If you want to run it in both the iPhone Simulator and a real iPhone Device (you do), you’ll need to create a ‘fat’ library containing both armv7 and i386 architecture code. If you want to support iPhone 3 instead then you’ll need to include armv6 architecture code. It’s best therefore to build the library with all 3 architectures.
Here’s a couple of resources that describe how to build openssl for iOS:
http://atastypixel.com/blog/easy-inclusion-of-openssl-into-iphone-app-projects/
https://github.com/st3fan/ios-openssl
EDIT: I actually modified st3fan’s build script, which I have pasted here:
setenv.sh and build_openssl.sh
Download these scripts and keep them somewhere like ~/bin (review them and then
chmodthem 0755 once you are sure they are not malicious).Next edit
setenv.shas it assumes there is a directory where you will install your 3rd-party libraries. By default this is/opt/local/ioslibsso make sure that exists and is owned by you else the final bit will fail. It’s been configured for Xcode 4.2/iOS SDK 5 using the default locations so that might need correcting too.build_openssl.shis configured to build a specific version of openssl (1.0.0e) and will download the source tarball if it’s not in the current directory (you needwgetfor that, but if you cannot be bothered to installwgetthen manually download it using the link within the script). When you run it, it will build the library in armv6, armv7 and i386 arch’s and copy the correct files to the installation directory.