Skip to content

IMSCryptoUtilsSimpleEncryptData #13

Description

@editdb

The following string lengths do not encrypt: 15, 31, 47, 63, 79, 95, 111, 127, 143, 159, 175, 191, 207, 223, 239, 255, 271, 287, 303, 319, 335, 351, 367, 383, 399, 415, 431, 447, 463, 479, 495, 511, 527, 543, 559, 575, 591, 607, 623, 639, 655, 671, 687, 703, 719, 735, 751, 767, 783, 799, 815, 831, 847, 863, 879, 895, 911, 927, 943, 959, 975, 991, 1007, 1023, etc etc

The fix is as follows:
// create a buffer
size_t ciphertext_len = ([plaintext length] + kCCBlockSizeAES128 + [iv length]);

// Patch - the output length should be calculated using this iOS function.
// If this line is not included, then 1/16th of strings will fail encryption
// for an incorrect output buffer size kCCBufferTooSmall reported from CCCryptorFinal
ciphertext_len = CCCryptorGetOutputLength(cryptor, ciphertext_len, true);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions