Search code examples
objective-cencryptioncommoncrypto

Objective c - CCCryptorStatus without CCOptions


I would like to know, how can I define a CCCryptorStatus without using CCOptions. The documentation said, if I don't set the kCCOptionECBMode, the default is CBC mode, which is good for me. But I don't need for kCCOptionPKCS7Padding too, so how can I set this?

I try:

CCCryptorStatus cryptStatus = CCCrypt(opMode,                   /* Defines the basic operation: kCCEncrypt or kCCDecrypt */
                                      kCCAlgorithmAES128,       /* Defines the encryption algorithm */
                                      0,...

but this is the correct way? Because if I want to use this method, I get an NSData object with full of 0, but with the correct size. So I don't think this value is good... Thanks for any reply, madik


Solution

  • When I encountered this problem, I had to use kCCOptionPKCS7Padding. As far as I can see it's the only solution.

    Please note, that using of the padding increases the security.