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

Padding #6

Closed
randomlogin opened this issue Dec 17, 2015 · 1 comment
Closed

Padding #6

randomlogin opened this issue Dec 17, 2015 · 1 comment

Comments

@randomlogin
Copy link

Hi! I'm not very proficient with js and didn't investigate this document too much, but it seems to me you have wrong usage of padding ('ece.js', line 145):

var padding = new Buffer(pad + 1);

here you initialize padding with some random bytes allocated for it, however in the specification it should be a length byte, then zero bytes.

A receiver MUST fail to decrypt if any padding octet other than the first is
non-zero, or a record has more padding than the record size can
accommodate.

So, it seems this implementation is contradicting with this document.

By the way, function encryptRecord is nowhere used with padding parameter, so it's always zero.

Sorry if I'm treating anything wrong.

@martinthomson
Copy link
Member

Yes, that particular piece of code isn't hooked up, so I didn't discover that bug until I decided to use it.

I have a fix for this already. Unfortunately, it's currently sitting on a computer that I won't have access to for a while. I'll put a simple fix in for now.

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

No branches or pull requests

2 participants