I am using the StringEncryption.m library in iOS to encrypt messages, and then decode them on a .Net project.
For 99.9% of messages, the encryption / decryption process works. However, there is a particular message that the iOS app sends which always results in a "Padding is invalid" error on the .Net project.
The problem message is 800 bytes long. If i force it to be 799 or 801 bytes, the encryption / decryption works.
Both sides are using CBC and the iOS solution uses PKCS7 padding. Any ideas?
Followed Ramhounds guidance and produced a different message of the same length. Problem is down to the encryption library on the iOS.
Found the answer here: Encrypting 16 bytes of UTF8 with SecKeyWrapper breaks (ccStatus == -4304)