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

Invalid secret key length for crypto_sign_detached #58

Open
tomasgvivo opened this issue Oct 4, 2021 · 0 comments
Open

Invalid secret key length for crypto_sign_detached #58

tomasgvivo opened this issue Oct 4, 2021 · 0 comments

Comments

@tomasgvivo
Copy link

I found a problem while implementing the "4. Server accepts" section on the documentation when computing detached_signature_B .

I think there is something wrong in the documentation.

To my understanding, server_longterm_sk is 32 bytes long and crypto_sign_detached expects a 64 bytes long key.

When I try to implement the secure handshake myself using the sodium-native package, I get the following error:

                    sodium.crypto_sign_detached(detached_signature_B, msg, server_longterm_sk);
                           ^
Error: "sk" must be crypto_sign_SECRETKEYBYTES bytes long
    at Socket.<anonymous> (~/index.ts:146:28)
    at Socket.emit (node:events:369:20)
    at Socket.emit (node:domain:470:12)
    at addChunk (node:internal/streams/readable:313:12)
    at readableAddChunk (node:internal/streams/readable:288:9)
    at Socket.Readable.push (node:internal/streams/readable:227:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)

Where server_longterm_sk is 32 bytes long and sodium.crypto_sign_SECRETKEYBYTES's value is 64.

Link to documentation: https://ssbc.github.io/scuttlebutt-protocol-guide/#:~:text=key%3A%20server_longterm_sk
Links to libsodium definition of crypto_sign_SECRETKEYBYTES https://github.com/jedisct1/libsodium/blob/6d566070b48efd2fa099bbe9822914455150aba9/src/libsodium/include/sodium/crypto_sign.h#L40 and https://github.com/jedisct1/libsodium/blob/6d566070b48efd2fa099bbe9822914455150aba9/src/libsodium/include/sodium/crypto_sign_ed25519.h#L34

Is there something wrong with the documentation? Or have I misunderstood something?

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

1 participant