Encrypting Text in Objective-C

Discussion in 'Mac Programming' started by RevK, Aug 3, 2008.

  1. RevK macrumors member

    Joined:
    Apr 26, 2004
    #1
    Hello MacRumors,

    I have been thinking about trying to encrypt text in Objective-C, preferably using TDES. I have no idea where to start. Is there a publicly available framework for easy encrypting and decrypting w/key? Is there is, some help implementing that into an XCode project would be great.

    If there is not, how does one write one? All I preferably would like is a quick and easy solution to this.

    Thanks!
     
  2. SC68Cal macrumors 68000

    Joined:
    Feb 23, 2006
  3. yeroen macrumors 6502a

    yeroen

    Joined:
    Mar 8, 2007
    Location:
    Cambridge, MA
    #3
    As the above poster said, you need to use the OpenSSL C-libraries. The best explanation of how to use OpenSSL is the OReilly book. The online documentation is a bit sparse, and the man pages are only helpful if you already know what you're looking for.
     
  4. RevK thread starter macrumors member

    Joined:
    Apr 26, 2004
    #4
    Which O'Reilly book are you referring to? There are many Cocoa ones.
     
  5. birdsong macrumors newbie

    Joined:
    Oct 16, 2006
    #5
    OpenSSL is the way to go, but why not use AES? It's now a more accepted symmetric encryption algorithm than DES, has a concise mathematical structure, and has stood up to very rigorous analysis.
     
  6. RevK thread starter macrumors member

    Joined:
    Apr 26, 2004
    #6
    I'm not sure why I decided on TDES, I've just heard about it alot recently. Are they both available in OpenSSL?
     
  7. yeroen macrumors 6502a

    yeroen

    Joined:
    Mar 8, 2007
    Location:
    Cambridge, MA
    #7
  8. birdsong macrumors newbie

    Joined:
    Oct 16, 2006
    #8
    Yes, both are. AES runs much quicker than Triple DES (not that it really matters on modern hardware). Triple DES should only really be used in cases where other ciphers are not possible. AES is not the only good modern symmetric cipher, but it's probably the most widely used.

    Even though Triple DES has a 168 bit key length, the effective key length is only 112 bits due to a so-called meet-in-the-middle attack. AES on the other hand has 128, 192, and 256 bit variants.
     
  9. RevK thread starter macrumors member

    Joined:
    Apr 26, 2004
    #9
    Ok, thanks for the information, I think I will go with AES then.

    For this little mini-project I am doing, I just would like to be able to encrypt an array of data (or start with just some text). Do I need to download the OpenSSL C libraries or are they already included in the Developer tools? I've only ever used basic Cocoa libaries.
     
  10. birdsong macrumors newbie

    Joined:
    Oct 16, 2006
    #10
    I'll have to defer to others on that. I've never written a lick of Cocoa in my life. I just know a bit about encryption.

    OpenSSL is absolutely included in OS X (go to the command line and run 'openssl' -- this is the front end that uses libopenssl). If I had to guess, using it in Cocoa is just a matter of linking. Googling "openssl cocoa" turns up some info.
     
  11. RevK thread starter macrumors member

    Joined:
    Apr 26, 2004
    #11
    Thank you so much for pointing me toward OpenSSL (all of you guys). I found this site from that google search (http://tombuntu.com/index.php/2007/12/12/simple-file-encryption-with-openssl/) which has been very helpful.

    If I have any other problems with my project, I will post again. Thanks!
     
  12. mpramodjain macrumors regular

    Joined:
    Nov 20, 2008
    Location:
    Banglore
    #12
    Hi All,

    Had any one had success on decrypting the DUKPT+3DES Encrypted content. Actually I am using an external credit card reader (iDynamo), where it is responding with DUKPT+3DES Encoded content.

    Any idea how to decode it using Objective C. I don't have any key, how it was encoded.
     
  13. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #13
    The key for stealing the data off a credit card's chip is...
     
  14. mpramodjain macrumors regular

    Joined:
    Nov 20, 2008
    Location:
    Banglore
    #14
    Hi jimi,

    Didn't understood what you are trying to say. Can u please make it a bit clear , regarding how can I get key , using DUKPT Key management.
     

Share This Page