auditdrivencrypto / secret-handshake

Mutually authenticating key agreement handshake
MIT License
202 stars 29 forks source link

publicKey in serverVerifyAuth #13

Closed AljoschaMeyer closed 6 years ago

AljoschaMeyer commented 6 years ago

In serverVerifyAuth, the server receives the longterm public key of the client by calling state.remote.hello.slice(64, exports.client_auth_length). The resulting slice has length 112 bytes - 64 bytes = 48 bytes. But isn't the public key only 32 bytes long?

AljoschaMeyer commented 6 years ago

Yup, turns out state.remote.hello is only 96 bytes long (or at least the equivalent buffer in my implementation is). Node just "conveniently" ignores that 112 is too long and simply slices to the end of the buffer.

dominictarr commented 6 years ago

yes that is the sort of thing node does. yes that should be the unboxed length not the boxed length. good spotting.