<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">Hi all,</div><div class=""><br class=""></div><div class="">I've been implementing the NoiseSocket protocol in C# for the last several days. The library is not yet done (it will probably be in a week or so), but I think I have enough feedback on the spec.</div><div class=""><br class=""></div><div class="">It's fairly easy to follow and implement. First four sections are clear, but I think that the API section needs a bit more work.</div><div class=""><br class=""></div><div class="">1) Initialize</div><div class=""><br class=""></div><div class="">Current definition:</div><div class="">- INPUT: pattern, dh, cipher, hash</div><div class="">- OUTPUT: session object</div><div class=""><br class=""></div><div class="">It's strange that not all inputs are specified here. I would either mirror the definition of Initialize in HandshakeState from the Noise specification:</div><div class="">INPUT: handshake_pattern, initiator, prologue, s, e, rs, re</div><div class=""><br class=""></div><div class="">Or maybe just say something more abstract like:</div><div class="">INPUT: noise_protocol</div><div class=""><br class=""></div><div class="">I think that the OUTPUT is not necessary here, so I would just remove it—it's not clear what is the meaning of "session object", and it's not mentioned anywhere else in the specification (except in Reinitialize).</div><div class=""><br class=""></div><div class="">2) ReadHandshakeMessage</div><div class=""><br class=""></div><div class="">ReadHandshakeMessage takes handshake_message as a parameter. This may lead the implementer to believe that the parameter is a byte sequence that contains the whole message that the user has somehow obtained prior to the call. In practice, you will most likely pass the input stream as a parameter, and read the handshake_message from it (when I say stream, I mean something that you can read a sequence of one or more bytes from, like Go's io.Reader, or Java's InputStream). Maybe someting like this would be clearer:</div><div class=""><br class=""></div><div class="">ReadHandshakeMessage:</div><div class=""><br class=""></div><div class="">- INPUT: input_stream</div><div class="">- OUTPUT: message_body</div><div class="">- DESCRIPTION: Reads the handshake_message from the input_stream and returns the message_body.</div><div class=""><br class=""></div><div class="">If you think that the idea with streams makes sense, then all similar functions would be updated in the same fashion.</div><div class=""><br class=""></div><div class="">3) PeekHandshakeMessage</div><div class=""><br class=""></div><div class="">PeekHandshakeMessage will probably completely consume the negotiation data, so I would just rename it to ReadNegotiationData.</div><div class=""><br class=""></div><div class="">4) WriteEmptyHandshakeMessage</div><div class=""><br class=""></div><div class="">It does exactly the same thing as the WriteHandshakeMessage when the message_body is omitted, so I would just drop this one.</div><div class="">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><br class="">Nemanja</div>

</div>

<br class=""></body></html>