verify.js 587 B

123456789101112131415161718192021
  1. 'use strict'
  2. // import ecc from 'eosjs-ecc'
  3. // or
  4. const ecc = require('eosjs-ecc')
  5. // 公钥 EOS7Ncm9F6jq25HrTgnJ9hNo5QtdMuPRcPv8QvbmnHVJEnZHFwV7E
  6. // 秘钥 5K48UvhALZVd7hrq4CzrNL3GCvTAZ7s1dnMs9rLjbot8XNm9B1P
  7. // 密文 SIG_K1_KWp84G79nTuw4C11BXVoydCh6q9tFGP5y4UuCgqLB5WNA1p7MF3fJ6W155ggCLWjrxYwntym1kch3yAE9DxRsKzyG1XxJu
  8. // pk, $msg, $encoded_msg
  9. let data = process.argv[2];
  10. let pubkey = process.argv[3];
  11. let sign = process.argv[4];
  12. if (!data || !pubkey || !sign) {
  13. console.error('param is not valid.');
  14. return;
  15. }
  16. let flag = ecc.verify(sign, data, pubkey);
  17. console.log(flag);