-
Notifications
You must be signed in to change notification settings - Fork 24
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
Values seem to be incorrect compared with other libraries #24
Comments
Hey @zbarbuto 👋 Thanks for opening this issue! There is indeed some incompatibilities, and they have previously been discussed in #12, and a potential solution is open as PR #13. There is however still some uncertainty on wether we should also pad Thanks! |
Hey, sorry I tried to search for the issue but wasn't able to find. Thanks for the links - I suppose this could be marked as duplicate of #12 |
Would you mind posting your findings in that thread as well, or would you be okay with me copying your post over to a comment there? I think that it's great information to have! |
Thanks! ❤️ |
I've tested this library on it's own as per the docs and can see that it will correctly verify the client as expected. However, I've tried passing values between this and other SRP libraries and the values seem not to verify (while they would when passing between the other libraires alone).
This includes:
jsrp
as the client andsecure-remote-password
as the sever (and vice versa)sirp
as the sever andsecure-remote-password
as the clientsirp
as the sever andjsrp
as the clientI've found that while
sirp
andjsrp
will happily communicate and verify against each other,secure-remote-password
will not verify client values fromjsrp
configured in2048
mode andsirp
on the server will not verify client values fromsecure-remote-password
. I've yet to getsecure-remote-password
to successfully work with another library.After much digging, the only thing I can find that might be causing the issue is that the
k
values being used are different. I compared all the hex values form both calculations of aB
value (secure-remote-password
'sconst B = k.multiply(v).add(g.modPow(b, N)).mod(N)
andjsrp
'sthis.k().multiply(v).add(this.params.g.modPow(b, this.params.N)).mod(this.params.N)
and all hex values were identical expect thek
value.It's strange because the calculations seem to be the same:
secure-remote:
exports.k = sha256(exports.N, exports.g)
vs
jsrp:
createHash(this.params.hash).update(transform.pad.toN(this.params.N, this.params)).update(transform.pad.toN(this.params.g, this.params)).digest();
Both use the same values for
N
andg
. The only difference seems to be thatjsrp
will pad theg
value to the same length as theN
value in the hash.k value from
jsrp
:5b9e8ef059c6b32ea59fc1d322d37f04aa30bae5aa9003b8321e21ddb04e300
k value from
srp-js
(a fork ofnode-srp
by mozilla):5b9e8ef059c6b32ea59fc1d322d37f04aa30bae5aa9003b8321e21ddb04e300
k value from
secure-remote-password
:4cba3fb2923e01fb263ddbbb185a01c131c638f2561942e437727e02ca3c266d
The text was updated successfully, but these errors were encountered: