Any cocoa source code for AES encryption decryption?

后端 未结 4 1478
情歌与酒
情歌与酒 2020-11-28 08:04

I am searching for some cocoa code on AES encryption and I did some google search for it. I found this very useful link - http://iphonedevelopment.blogspot.com/2009/02/str

4条回答
  •  一生所求
    2020-11-28 08:27

    AES128 encryption is available on the iPhone in the CommonCrypto framework. The relevant functions are in the CommonCryptor.h header.

    You can create a cryptor like so:

    // Assume key and keylength exist
    CCCryptorRef cryptor;
    if(kCCSuccess != CCCryptorCreate(kCCEncrypt, kCCAlgorithmAES128, 0, key, keyLength, NULL, &cryptor))
      ; //handle error
    
    // Repeatedly call CCCryptorUpdate to encrypt the data
    
    CCCryptorRelease(cryptor);
    

    It seems from the question and the link that you are looking for example implementations of AES. I would not recommend this- use Apple's implementation!

    It looks like http://pastie.org/297563.txt might help you also, but I haven't tested it.

提交回复
热议问题