Skip to content
This repository has been archived by the owner on Jun 7, 2019. It is now read-only.

lisk.crypto.verifyMessageWithPublicKey(signature, publicKey) should take care of invalid input #107

Closed
slaweet opened this issue Apr 21, 2017 · 0 comments

Comments

@slaweet
Copy link
Contributor

slaweet commented Apr 21, 2017

Expected behaviour

When there is something wrong with signature or publicKey, then it should throw an error that says that

> lisk.crypto.verifyMessageWithPublicKey('b146607c3fce1aaef4e52a632ab5eddc83fc18d3b3b6f97fdd531568fa1b236687a1bbadc65c9fa8b62f00ec4e5c80d1ef4bce09bd4ac475393f0a39f7376c0668656c6c6faERROR', '197cf311f678406bc72a8edfdc3dffe6f59f49c4550a860e4b68fb20382211d0')
Uncaught Error {message: "Invalid signature"}
> lisk.crypto.verifyMessageWithPublicKey('b146607c3fce1aaef4e52a632ab5eddc83fc18d3b3b6f97fdd531568fa1b236687a1bbadc65c9fa8b62f00ec4e5c80d1ef4bce09bd4ac475393f0a39f7376c0668656c6c6fa', '197cf311f678406bc72a8edfdc3dffe6f59f49c4550a860e4b68fb20382211d0ERROR')
Uncaught Error {message: "Invalid public key"}

Actual behaviour

Currently it throws some arbitrary error from the underlying library

> lisk.crypto.verifyMessageWithPublicKey('b146607c3fce1aaef4e52a632ab5eddc83fc18d3b3b6f97fdd531568fa1b236687a1bbadc65c9fa8b62f00ec4e5c80d1ef4bce09bd4ac475393f0a39f7376c0668656c6c6faERROR', '197cf311f678406bc72a8edfdc3dffe6f59f49c4550a860e4b68fb20382211d0')
nacl_factory.js?7fc7:74 Uncaught TypeError: Cannot read property 'length' of null
    at decode_latin1 (eval at <anonymous> (app.js:3784), <anonymous>:74:24)
    at Object.decode_utf8 (eval at <anonymous> (app.js:3784), <anonymous>:69:35)
    at Object.verifyMessageWithPublicKey (eval at <anonymous> (app.js:4720), <anonymous>:67:22)
    at <anonymous>:1:13
decode_latin1 @ nacl_factory.js?7fc7:74
decode_utf8 @ nacl_factory.js?7fc7:69
verifyMessageWithPublicKey @ sign.js?e51f:67
(anonymous) @ VM379906:1
> lisk.crypto.verifyMessageWithPublicKey('b146607c3fce1aaef4e52a632ab5eddc83fc18d3b3b6f97fdd531568fa1b236687a1bbadc65c9fa8b62f00ec4e5c80d1ef4bce09bd4ac475393f0a39f7376c0668656c6c6fa', '197cf311f678406bc72a8edfdc3dffe6f59f49c4550a860e4b68fb20382211d0ERROR')
nacl_factory.js?7fc7:145 Uncaught Object {message: "nacl.crypto_sign_open expected 32-byte pk but got length 34"}
@slaweet slaweet added this to the Version 0.4.1 milestone Apr 21, 2017
@toschdev toschdev added this to Ready in Version 0.4.1 Apr 21, 2017
@toschdev toschdev moved this from Ready to In Progress in Version 0.4.1 Apr 21, 2017
@karmacoma karmacoma removed this from In Progress in Version 0.4.1 Apr 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants