Rijndael encryption

Hi,

I found a cocoa extension for NSData class, that implements the Rijndael encryption/decryption. But it uses headers from Ruby.framework, which is not present in iPhoneSimulator 2.0 SDK. How do I config my Xcode project in order to be able to use these extensions?

Thanks in advance,

Nava.

P.S. the file is

#include <openssl/aes.h>

Mac OS X (10.5.4), MacIntel, iPhoneSimulator 2.0

Posted on Jul 20, 2008 10:20 AM

Reply
29 replies

Jul 22, 2008 5:28 AM in response to navac

One easy way is to use the AES code provided by Dr Brian Gladman at http://fp.gladman.plus.com/AES/
It is open source and needs only an acknowledgment in the app.
I have used this in early Mac apps prior to Apple providing AES support.

Encoding a file with a block cypher presents the problem of padding the file to a multiple of the block size and this can be done many different ways, there does not seem to be a standard.

Finally, getting crypto right is not as easy as one might expect, best to get some expert help or at least a review by a crypto expert.

Jul 22, 2008 7:11 AM in response to navac

At least this problem was solved in the following way: I want to link the two libraries as static libs, -lcrypto linker by default is looking for a .dylib with the same name. I changed names of built OpenSSL libraries to <library>_<suffix>.a and I could link. Just in case somebody has a similar problem.

I wasn't aware about the BIS document. Thank you for raising this issue.

Nava

Jul 22, 2008 10:13 AM in response to blazespinnaker

Yes, I did exactly the same thing. Sent an email to BIS and then uploaded this email in pdf format to iTunesconnect. Now the status has not changed since two days and I do not know whether there is anything to do from my side.

Sent an mail to Apple but got nothing back. I use Blowfish 128, which is public domain and should only require a TSU notification to BIS.

Chased the BIS as well as Apple but they aren't responding. This is frustrating.

Will post here if I have some more insight into the process.

Cheers

Jul 23, 2008 4:15 AM in response to sunaj

I realize that BlowFish is easy to implement, easy code to integrate. The next easiest is AES via OpenSS. The "Gladman" code is rather easy as well, I used it several years ago.

Currently there are two cyphers currently that are in mainstream usage for new apps yes there are others with lesser use). DES, usually now Triple DES, is used for electronic banking for historic reason and AES for new usage. One should have a compelling reason to use anything else. One other interesting choice is TEA (Tiny Encryption Algorithm) http://en.wikipedia.org/wiki/XXTEA but should be relegated to "Toy Usage" but is probably fine where the user is allowed to choose poor passwords.

If you are going to do crypto and don't have lot's of time to spend studying get "Secure Programming Cookbook" from O'Reilly ad use the samples. Here are some issues, if you don't understand them then you need to do some studying: Do not use a password for the encryption key, use a HMAC to generate the key. Why rand() should not be used. How to chose an IV. ECB vs CBC mode. How to pad a file's size to cypher block size. A file will become larger (by a few bytes) due to padding. Using a stream cypher maintains the file size but is a bad idea.

On any serious project I always pay a security expert to review the design and implementation.

Aug 20, 2008 3:44 PM in response to gabriel960

Sorry for the late reply.

The TSU Notification will not suffice. The TSU is only for public domain software. As you will distribute your app through the App Store I guess it will not be in the public domain.

You need to use the multi form BIS-748P for a mass market product. This form is not available for download. You want to apply for a PIN for the SNAP-R service. This will take approx 10 days. To get the PIN you need to send a Company Certification to their fax @ 202-219-9182. Use this number. The other number given on their web site is not working.

After that you will be able to send in your documents to their SNAP-R portal. Then they will have a look at the documents (this will take another 30 days). The whole process is ridiculous and frustrating.

http://www.bis.doc.gov/encryption/massmarket_keys64bitsnup.html is a good starting point to get things going.

Good luck - you will need it 🙂

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Rijndael encryption

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.