I need to implement jcryption in IOS. I have gone through the library it uses Rijndael encryption internally to encrypt the data.
I have tried AES256EncryptWithKey but it is not giving me expected encryption key.
Any help on this would be nice. Thanks
Rijndael with a 128-bit block size is AES. Use Common Crypto on iOS, it uses the hardware encryption engine. There are several ObjC AES answers here on SO, see iOS AES Encryption.
For a detailed answer you will need to provide your usage information on jCryption.
Also notice that jCryption has been discontinued. If you are trying to use jCryption in place of HTTPS the correct solution is to use HTTPS, see jCryption.
Related
I'm converting an Android app to iOS. The Android version uses CMAC-AES cryptography, but I couldn't find CMAC for iOS. Does anyone know a library or could give a tip? I am not familiar with cryptography, so I am little messy.
CMAC stands for Cipher-based Message Authentication Code, that means it's a message authentication code (it is used to authenticate data and avoid any corruption of the data being authenticated) that uses ciphers to achieve its goals, in your particular case it uses the AES cipher to do so.
There are indeed some libraries that you could use, you may use OpenSSL (you may try others tutorials that links OpenSSL to your project) which is a well adopted library and heavily maintened.
I am developing an app that stores PDF files. These files should be stored secure, i. e. encrypted. I also found some libraries that extend NSData with AES en/decryption. But then I read, that iOS supports hardware encryption via AES. Is the NSData library really necessary if they both provide AES256 encryption?
If there are differences, which way is more secure? Also.. how do I activate the hardware encryption? Or is this a global setting that applies to all apps? I guess that the files become decrypted after the device is unlocked? So if someone cracks my phone he has also access to the decrypted files? But if I do the encryption by myself and connect the decryption with a SHA hashed password that is stored in the keychain the files might still be inaccessible?
Edit:
Did I get it all wrong and my library (AQToolkit) is just some kind of API for the built-in hardware encryption and I am basically talking about the same thing?
I heartily recommend RNCryptor, which uses Apple's own Security.framework guaranteeing hardware encryption/decryption if possible. It's incredibly easy to use in the default case (AES-256 with 10k iterations of PBKDF2). It's not an encryption library per se, but rather an Obj-C packaging of the open source Common Crypto C library. Check it out.
I've worked with Java cryptography for many years. Now, we have a requirement to write an iOS application that will send encrypted payloads from the mobile device to a Java service. I've begun working with the iOS crypto support (CommonCrypto, etc.) and have found it a bit more difficult. The JCE has a very clean, concise API, so I've clearly gotten spoiled. In contrast, iOS cryptography is a far more difficult API to work with.
Are there any simplified crypto libraries or wrappers around CommonCrypto that provide a more concise API? In particular, we need:
Key generation (both symmetric and asymmetric)
Encryption/decryption of data
Digital signatures (SHA1withRSA, for example)
Hashing
RSA, 3DES, and AES support
I know I've seen a sample class or two that wraps AES encryption, for example. I'm looking for something a bit richer and more full-featured. Anyone have any suggestions?
You can use openSSL inside your iOS app, for ease of use you can use the SSCrypto library by septicus.
From the septicus site:
SSCrypto.framework provides a simple wrapper around OpenSSL library
functions for encryption, decryption (both symmetric and RSA) and
checksums. It also encodes and decodes base64 data and can generate
both private and public RSA keys. A test tool is included in the
project. Click here to see the main.m file that comes with SSCrypto
for examples of it's use.
I am building a Monotouch application which downloads data from the server encrypted using AES. I then need to decrypt this data when the file is accessed.
What is the best way for doing this using MonoTouch? iOS AES decryption is apparently hardware accelerated and so I would ideally like to call into CCCrypt. I am a bit of a n00b to MonoTouch so does anyone know how to do this?
Or alternatively is there a better approach to doing AES decryption in MonoTouch?
MonoTouch provides AES support inside it's class library, e.g. the RijndaelManaged class.
However you need to know a bit more about how it was encrypted (cipher mode, padding mode, key size) to be able to decrypt a file. Also depending on the file size you might want to decrypt it in memory (safer) if it's small or to a temporary file (if large).
Notes:
Rijndael is the original name of the algorithm that got selected to be AES;
AES is a subset of Rijndael (only one block size, 128 bits) so you can do everything AES supports using RijndaelManaged;
At the moment MonoTouch does not use CommonCrypto (it uses the managed implementation from Mono) so you won't get hardware acceleration. This will likely change in future releases (and will be compatible, i.e. simply re-compile, for people who used RijndaelManaged in their applications).
EDIT
MonoTouch 5.3.3 (alpha) now default to use CommonCrypto implementations, including hardware acceleration (when available) for AES and SHA1.
If you are interested in encrypting data at rest (i.e. a database) under MonoTouch SQLCipher might be a good option (http://sqlcipher.net). The MonoTouch provider for SQLCipher provides SQLite full database encryption using AES-256 (http://sqlcipher.net/sqlcipher-for-monotouch). There is also a companion library for Mono on Android, which provides the same API and features for android (http://sqlcipher.net/sqlcipher-on-mono-for-android)
Disclosure: I work for Zetetic, the author of SQLCipher.
Is there a support for zip with encryption on the iPad? Also, looks like there are security flaws in using zip with encryption. Could you someone give some information on this?
Thanks,
Praveen
ZIP's default encryption indeed has security problems (weak encryption used). WinZIP and PKZip independently offered their own stronger encryption mechanisms. WinZIP offered only symmetric (AES-based) encryption, while PKZip also offers certificate-based encryption (but only within their own products - third-parties are allowed to only decrypt files encrypted with certificates).
Zip old-style decryption is definitely weak, however new implementations (WinZIP and others) can use AES for encryption. And, as well there is a lot of open source implementations (InfoZIP for instance) which can be used on iPhone, and support that encryption type.