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

ecc.isValidPublic() return false on some valid public keys #48

Open
UMU618 opened this issue Mar 18, 2019 · 2 comments
Open

ecc.isValidPublic() return false on some valid public keys #48

UMU618 opened this issue Mar 18, 2019 · 2 comments

Comments

@UMU618
Copy link

UMU618 commented Mar 18, 2019

ecc.isValidPublic('EOS5K6ag7t87u3F4jdkmt73wQtd9oprQFyJsp6vskrrwoQoPqcPdE7') return false #489

Version
eosjs 20.0.0-beta3
eosjs-ecc 4.0.4

Describe the bug

  1. ecc.isValidPublic() return false on 2 public keys of account 1255gdpaftgs
  2. Point.decodeFrom() report 'Invalid sequence tag'

To Reproduce

  1. get the public keys of 1255gdpaftgs

  2. validate these keys using ecc.isValidPublic()

# umu @ UMU-MBP in ~/github/meet-one/mainnet-snapshot on git:master x [21:45:27]
$ cleos -u https://mainnet.meet.one get account 1255gdpaftgs
created: 2018-11-08T01:25:13.500
permissions:
     owner     1:    1 EOS5K6ag7t87u3F4jdkmt73wQtd9oprQFyJsp6vskrrwoQoPqcPdE7
        active     1:    1 EOS5Kkxpsx71txnR8niEmZmcG6d6AeSQqYw1qfXYQBDkgh5v4tbGxH
memory:
     quota:     5.345 KiB    used:     3.365 KiB

net bandwidth:
     staked:          0.1000 EOS           (total stake delegated from account to self)
     delegated:       0.0000 EOS           (total staked delegated to account from others)
     used:                 0 bytes
     available:        79.93 KiB
     limit:            79.93 KiB

cpu bandwidth:
     staked:          0.1000 EOS           (total stake delegated from account to self)
     delegated:       0.0000 EOS           (total staked delegated to account from others)
     used:                 0 us
     available:        12.63 ms
     limit:            12.63 ms

producers:     <not voted>


# umu @ UMU-MBP in ~/github/meet-one/mainnet-snapshot on git:master x [21:45:33]
$ node
> const ecc = require('eosjs-ecc')
undefined
> ecc.isValidPublic('EOS5K6ag7t87u3F4jdkmt73wQtd9oprQFyJsp6vskrrwoQoPqcPdE7')
false
> ecc.isValidPublic('EOS5Kkxpsx71txnR8niEmZmcG6d6AeSQqYw1qfXYQBDkgh5v4tbGxH')
false

Expected behavior
true, but return false.

More
It seems like a bug of ecurve 1.0.5

ecc.PublicKey('EOS5Kkxpsx71txnR8niEmZmcG6d6AeSQqYw1qfXYQBDkgh5v4tbGxH')

type is 128, isValidPublic() = false

ecc.PublicKey('EOS7enq7SL9AUhBYgkYMksj34LPKtAr7iu56KKrNTcUPTRqTp5VaN')

type is 3, isValidPublic() = true

I use C++ code to validate these keys, and the test passes.

BOOST_AUTO_TEST_CASE(test_by_UMU) try {
   auto pub_str = std::string("EOS5Kkxpsx71txnR8niEmZmcG6d6AeSQqYw1qfXYQBDkgh5v4tbGxH");
   auto pub = public_key(pub_str);

   std::cout << pub_str << " => " << pub << std::endl;

   BOOST_CHECK(pub.valid());
   BOOST_CHECK_EQUAL(pub_str, std::string(pub));
} FC_LOG_AND_RETHROW();
@antonio-fr
Copy link

@UMU618
Copy link
Author

UMU618 commented May 16, 2019

Maybe related to this ?
https://github.com/EOSIO/eosjs-ecc/pull/38/files

No.

The checksum of EOS8ddPoePGrH4x1mha1RHcbjU1cAWWFLWqBQF6Q35RrTsZdLouC1 is wrong, should be EOS8ddPoePGrH4x1mha1RHcbjU1cAWWFLWqBQF6Q35RrTsZdLouCm.

my issue is about unexcepted type, not checksum.

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

2 participants