Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialization vector of encrypted files is sent as padded base64 #4172

Closed
tulir opened this issue Mar 31, 2021 · 0 comments · Fixed by matrix-org/matrix-ios-sdk#1059
Closed

Comments

@tulir
Copy link

tulir commented Mar 31, 2021

Describe the bug
The iv value in encrypted files is sent as normal base64 instead of unpadded base64. This breaks other clients which require iv to follow the spec precisely.

To Reproduce

  1. Send an image with Element iOS in an encrypted room.
  2. View the (decrypted) event source, find the iv field and see unexpected == at the end:
    image

Expected behavior
iv is sent as unpadded base64 as specified in the spec:

The 128-bit unique counter block used by AES-CTR, encoded as unpadded base64.

Smartphone (please complete the following information):

  • Device: 8+
  • OS: 14.4.2
  • Version: 1.2.7
Johennes added a commit to Johennes/matrix-ios-sdk that referenced this issue Apr 1, 2021
This uses the existing `MXBase64Tools` to trim the `=` padding from the base64
encoded string. The reinsertion of the padding prior to decoding was already
implemented (line 224 in the same file).

Closes: element-hq/element-ios#4172

Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant