Search code examples
iphoneobjective-cmacosencryption3des

3DES Encryption in Objective-C


I am in the process of building an application for the iMac and iPhone. The goal of the application is to encrypt plain text messages, e-mails, passwords, dates, etc. I have done some research and found that 3DES would work great and is very secure. Does anyone know how to implement 3DES in Objective-C for the iPhone or Mac? Any help would be appreciated! Thanks!


Solution

  • DES is an old standard that is not secure anymore because of its short key length; 3DES is one way to get it safer (uses three times more key bits). But the new standard is AES, which you could try if you don't find (or don't like) any DES libraries out there that suits your needs. You could, for example, use OpenSSL or libgcrypt.

    But I wouldn't implement any of these from scratch. Implementing cryptographic algorithms is kind of tricky. You need to be careful with padding, random number generators and you should be aware that the textbook descriptions of these algorithms are usually simplified (and not safe for real-world use). One book that might help if you really want to implement crypto is Wenbo Mao's "Modern Cryptography". If you are math-oriented you could also use Katz and Lindell's "Introduction to Modern Cryptography".