-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Support for AES-256-CBC with W3C padding scheme ( http://www.w3.org/2001/04/xmlenc#aes256-cbc ) #368
Conversation
…ding scheme (based on readium/readium-lcp-client#26 )
Thanks @danielweck. The PR message was posted to the mailing list at PR 368: Support for AES-256-CBC with W3C padding scheme. It is a process formality. Would you happen to know if test vectors exist? I'd like to add them independent of this patch. That is, I'll cut them in, and they don't need to be part of the patch. |
Sent to the W3C editors and authors.
|
@noloader thanks for your prompt feedback! |
PS: also note that resources encrypted with AES-256-CBC PKCS#7 padding scheme can successfully be decrypted using the W3C-padding implementation proposed in this PR (but not vice-versa) |
Ack thanks.
Let me know if we can help. As long as Xcode changes don't break other builds, we can probably incorporate them. We test Apple operating systems like OS X and iOS, but WatchOS and AppleTV have gaps. I don't think they are being tested at the moment. Also see Issue 364. You can also reach out off-list at noloader, gmail account. |
Additional project files: |
Did test vectors materialize? Or, is there another (independent) implementation that I can generate them from? (I never heard back from the W3C editors or the authors). |
no exiting news from my end I'm afraid. |
Could you explain what you exactly mean the other party gets to view the arbitrary part if it is not set to specific value? Although meaning 'Arbitrary' includes PKSCS#5(7) and always-specific value such as 0, however if the decryption module is not carefully operated on the padding information, it says some hacking program could get the decryption value without knowing key. It means the decryption module would be better not to know the values of the arbitrary part. So I think it could be the more risky if the decryption module has to check the arbitrary part should be specific value. |
I'll be merging this today. There were no complaints from the folks on the user list. We will need to tweak it by adding a
Causes an exception:
I believe its due to Thanks again. |
Also see Commit 8e088b48654f78cb. |
Awesome additions @noloader ! :) Credits to @thkim2015 @drminside for the original code in this pull request, and thanks to @edrlab for hosting the actual fork :) (which I will update as soon as the next official CryptoPP release comes out) By the way, any idea when version |
…st (now merged to Crypto++ master branch, but not yet released), and additional original author's code, see: weidai11/cryptopp#368 (comment) Also see the following diff URL to see what changed in Readium LCP client lib's fork of CryptoPP at version 5.6.5 (added project files and W3C padding algo): edrlab/cryptopp@master...CRYPTOPP_5_6_5_CBC_W3C_PADDING#diff-a058f6967310c617f0e92efb3b5f1bd5
The next release will be 5.7 or 6.0. We inadvertently broke the ABI at 5.6.5, so we need a minor version bump to 5.7. We want to tweak the KDF interface so we can add modern derivation functions, and that will need a major version bump. I don't know when it will be ready. We hope it will be in the next couple of months. You might also consider pinging Jack Lloyd. He's the author of Botan. Its another good choice for C++ security libraries. Increasingly, I am using it for cross-validation. |
Thanks for the pointers! |
Also see Commit 8a177c58e692. |
This should have occurred with PR 368 or Commit 8e088b4
Quoted from:
readium/readium-lcp-client#26 (comment)
"
IMO, we need to consider why W3C suddenly added the padding restriction in 2002.
There was no padding details before 2002 in the W3C encryption standard. But after publishing the possibility of the Padding Oracle Attack on the block cipher algorithm in 2002, W3C had instantly updated the specification as size of the padding bytes should not be described in the padding block except last byte.
Key point of the padding oracle is that the last encrypted block before the PKCS#7 padding could be easily cracked, if the decryption program provides unnecessary error codes related padding.
So I think that not allowing using the vulnerable PCKS#7 on both server and client side is the clear way for not only consistency of the specification, but also the security perspective.
"
CC @thkim2015 @drminside