Skip to content

Arbitrary Message Signing #102

Description

@Wolog2021

We have a proposal from Vacuum Labs that needs review and approval.

Arbitrary message signing Ledger feature proposal:

JS interface:
signMessage(message, path, options)

  • message: message to sign in hex
  • path: derivation path in form, e.g. m/44'/539'/0'/0/0 (the same as for sign call)
  • cryptoOptions: a number encoding hash function and curve used (the same as for sign call)
    Return value (the same as for sign call):
    A dictionary with following fields
    returnCode: number,
    errorMessage: string,
    signatureCompact: Buffer/null,
    signatureDER: Buffer/null,

Behavior:
The behavior depends on the message length and content. As it is infeasible for the client to review large number of screens we define MAXIMUM_SCREENS=15 (You can modify this constant if another value suits is better for you). Screens are described as for NanoS, NanoX ans NanoS+ will have slight modifications due to larger screen size.

If the length of the message length is less than 34xMAXIMUM_SCREENS bytes and it contains only ASCII characters between 32 and 127 (printable ASCII characters), then we will display the message. We will use the same approach as transaction signing uses - we will use flash disc to store the whole message and then the user will be able to review the message content as follows:
Screen 1 to k:
key: "Message (1/k)"
value: 34 bytes of the message
Screen k+1
key: APPROVE
Screen k+2
key: REJECT
In expert mode there will be additional screen showing derivation path, hash function, and curve used.
Otherwise, we will just calculate the rolling hash of the message and show it to the user.
Screen 1:
key, value: "Calculate the message hash on secure device"
Screen 2
key: "Message hash (1/2)"
value: message hash in hex, characters 1-34
Screen 3
key: "Message hash (2/2)"
value: message hash in hex, characters 35-64
Screen 4
key: APPROVE
Screen 5
key: REJECT
In expert mode there will be additional screen showing derivation path, hash function, and curve used.

Reasoning:
If the message is arbitrary and long, it is infeasible to show the user the whole message in any representation. The need of computing the hash on a secure device (or at least separate device - which makes it way harder to perform an attack using a compromised client) is very inconvenient from the user perspective. This also creates security concerns as users may ignore this request and then they are vulnerable to attack by compromised client, however there is very little else that we can reasonably do in this case. That is why we try to show the message whenever it is reasonable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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