Skip to content

Invalid secret key length for crypto_sign_detached #58

@tomasgvivo

Description

@tomasgvivo

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions