CCCrypt encrypted with iphone can't be decrypted with ipad?

Discussion in 'iOS Programming' started by scanf, Nov 17, 2010.

  1. scanf macrumors newbie

    Apr 23, 2010
    ok, so i'm using CCCrypt successfully with an iphone app i have. i'm encrypting a file and manually put it in the project resources to later be decrypted at runtime. no problems.. until the app is started in the ipad simulator.

    it took me a while, but i found the only way i could avoid the problem is if i encrypted the exact same file using the ipad app and dropping this file with a different name in the folder next to the iphone version. it's A solution, but not a very nice one.

    not sure what the problem is here. i'm using the same key, but it looks like there's something different about how the iphone sim and ipad sim encrypt text?

    some important info:
    ipad simulator: 3.2
    iphone simulator: 4.0

    iphone OS Deployment target: iPhone OS 3.1.3

    anything here jump out at you as to why this is happening and what i could do to fix it? i'm ready to just throw in some ifdefs but that'd be one nasty kludge if there's an easier fix..

    btw, when i say it can't be decrypted, what i mean is the call to CCCrypt returns a CCCryptorStatus of kCCDecodeError.
  2. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    Are you expecting someone to solve this with no code, no algorithm name, no sample input data, no key, and no encrypted output data?
  3. scanf thread starter macrumors newbie

    Apr 23, 2010
    good point, and no. i'll try to put something together tonight.

    i guess i was just curious if anyone knew if the older deployment target would cause a problem, particularly on different iOS versions.

    i have a temporary solution which is just encrypting the data twice, once with the iphone sim, then the ipad sim, and storing those files seperately in the project's resources directory and ifdef'ing which device is in use to determine which file to load - that does work.
  4. bredell macrumors regular

    Mar 30, 2008
    Uppsala, Sweden
    It could be an endian problem, especially if you try to specify an encryption key as a constant in your code, but I'm not sure about the endianess of the iPad versus the different iPhone models.

Share This Page