Anyone else having trouble with iOS 5 encryption?

廉价感情. 提交于 2019-12-04 14:16:04

As described above, there was a change from iOS 4 to iOS 5 in that data is no longer copied to the target buffer if there is an error. So in iOS 4 one could be ignoring errors and still get good results, while that doesn't work in iOS 5. (I didn't write the original code -- I never would have ignored the errors.)

The errors were due to having kCCOptionPKCS7Padding specified while doing fixed-length block-multiple operations. (Not entirely sure how one arranges the buffers when doing padding, but it's not something I need to do.) Removing that option causes the operations to be error-free.

Sky

When removing kCCOptionPKCS7Padding on kCCDecrypt, and if original data before kCCEncrypt is not a multiple of the block length, the output data length after kCCDecrypt is different length than original data before kCCEncrypt.

So there is no error but the result is wrong.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!