小编gor*_*don的帖子

使用ios5加密的CCCrypt无法使用ios6进行解密

我的cocos2d游戏使用CCCrypt()加密保存数据.我使用mac地址作为加密密钥.在IOS5中加密的保存文件无法使用IOS6中的相同mac地址进行解密.这意味着更新游戏的用户将丢失所有数据!

有没有办法解密旧文件?

这是代码:

@implementation NSData (AESAdditions)
- (NSData*)AES256EncryptWithKey:(NSString*)key {
    // 'key' should be 32 bytes for AES256, will be null-padded otherwise
    char keyPtr[kCCKeySizeAES256 + 1]; // room for terminator (unused)
    bzero(keyPtr, sizeof(keyPtr)); // fill with zeroes (for padding)

    // fetch key data
    [key getCString:keyPtr maxLength:sizeof(keyPtr) encoding:NSUTF8StringEncoding];

    NSUInteger dataLength = [self length];

    //See the doc: For block ciphers, the output size will always be less than or
    //equal to the input size plus the size of one block.
    //That's why we …
Run Code Online (Sandbox Code Playgroud)

encryption objective-c ios ios5 ios6

6
推荐指数
1
解决办法
1578
查看次数

标签 统计

encryption ×1

ios ×1

ios5 ×1

ios6 ×1

objective-c ×1