AES Decryption in Swift - ios

I'm encrypting a file "info.plist" using openssl in mac.
openssl enc -aes-256-cbc -salt -in info.plist -out info.data -pass pass:myPass
How can I decrypt this info.data file in my iOS app?
I tried to use CryptoSwift pod but I can't figure out to make it work.

See the first answer for this question:Issue using CCCrypt (CommonCrypt) in Swift
It has an example for AES256 Decryption

Related

How to decrypt a file using privateKey.pem created with openssl in iOS

I am trying to decrypt a file which was encrypted using the openssl smime command.
Here are the steps I am following to create the certificate and encrypt the file.
For encryption: openssl smime -encrypt -binary -aes-256-cbc -in testFile.zip -out testFile.zip.enc -outform DER testCert.pem
I have created a certificate using this command-
openssl req -x509 -newkey rsa:4096 -keyout myPrivateKey.pem -out testCert.pem -days 365
Now, this file has been encrypted and saved to a server. I am downloading this file in my iOS Application.
Once Downloaded, I need to decrypt the file. Now, I am unable to do the same using Swift.
Is there a library or sample code that could help me get started in decrypting the file ?
I am very new to iOS and Cryptography.
I did have a look at the CommonCrypto and CryptoSwift. But haven't really got the solution yet.
I expect to get the zip file decrypted and stored at Directory or Library folder inside the application.

How to use openssl in swift private pod?

I followed below link to use openssl to generate pkcs12 file in a ios swift project.
https://stackoverflow.com/a/41856095/5059959
Now I want to create a private pod which requires openssl. How to can I do that?
I don't know how to do steps specified at above link
Could someone help me?

installing SSL sha256 in iis6.0

i have to install ssl certificate with sha256 algorithm in IIS6.0.And I have my own private key generated this during the CSR request,but not able to see the private key after installing SSL in IIS 6. Could you please help
Hi This issue has been resovled ,I had my private key in the OPENSSL folder as .key file. I have converted this to .pfx file using openssl commands.then reimported the certificate and private key.
Now i have my certificate with the Privatekey in the windows server2003.

Trigger.io : Where do i find android apk file created by 'forge run' command?

Didn't found this in their documentation. Where does apk file generated by "forge run android" is stored?
I am using Mac osx lion, if it's dependent on this.
An APK is created during the forge run android command, but it's deleted immediately after installing on the device; if you need to create an APK for use elsewhere or uploading to Google Play, see forge package android.
http://docs.trigger.io/en/v1.3/releasing.html#android
You need to generate a keystore file, and run the Package command in forge:
Generate a keystore by running: keytool -genkey -keystore choose-a-name.keystore -alias alias-name -keyalg RSA -keysize 2048 -validity 10000. Fill out the information that is asked for. A keystore-file is created.
Run the forge package android file or run the package tool via a web browser. If run for the first time, it will prompt you to provide the keystore file created in the previous step as well as the password you chose.
The location of the apk-file is printed as output.
More information about signing an app can be found on: http://developer.android.com/tools/publishing/app-signing.html. Also, Trigger's documentation is useful: https://trigger.io/docs/current/recipes/release/release_mobile.html

How to generate PKCS7 format signature using IOS iphone SDK?

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 chmod them 0755 once you are sure they are not malicious).
Next edit setenv.sh as it assumes there is a directory where you will install your 3rd-party libraries. By default this is /opt/local/ioslibs so 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.sh is 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 need wget for that, but if you cannot be bothered to install wget then 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.

Resources