Skip to content

Conversation

@nickbaum
Copy link

WARNING: I'm no crypto expert, so please review with care.

I ran into this same issue when trying to encrypt utf-8 text:

#4513

I believe the problem is that the plaintext is padded before it's encoded, and the encoding changes the length of the data.

Moving the encoding before the padding seems to resolve the issue.

WARNING: I'm no crypto expert, so please review with care.

I ran into this same issue when trying to encrypt utf-8 text:

StackStorm#4513

I believe the problem is that the plaintext is padded before it's encoded, and the encoding changes the length of the data.

Moving the encoding before the padding seems to resolve the issue.
@nickbaum
Copy link
Author

Hmm, nevermind. I believe this fails pull request works on Python 2 but not on Python 3, because pkcs5_pad can't concatenate str and bytes on Python 3:

data = data + pad * chr(pad)

Any thoughts on how to address this?

@Kami
Copy link
Member

Kami commented Jan 31, 2019

Thanks again for reporting this issue and working on it.

You were indeed on a right track. We need to convert data to bytes before we pad it - #4528 (and also update pad function so it handles bytes correctly).

Fix will be included in a future v2.10.2 release.

@nickbaum
Copy link
Author

🙌🏻Thanks for the quick follow up.

@nickbaum nickbaum closed this Jan 31, 2019
@nickbaum nickbaum deleted the patch-1 branch January 31, 2019 17:51
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 this pull request may close these issues.

2 participants