Add check for valid keys in `importprivkey` #3593

pull laanwj wants to merge 1 commits into bitcoin:master from laanwj:2014_01_importprivkey_check_key changing 1 files +3 −1
  1. laanwj commented at 9:06 AM on January 28, 2014: member

    The base58 armoring was checked, but not the resulting private key, which could be out of range. Fix this by adding a check.

    check errors due to wrong encoding

    importprivkey foo
    error: {"code":-5,"message":"Invalid private key encoding"}
    

    =0x00....

    importprivkey cMahea7zqjxrtgAbB7LSGbcQUr1uX1ojuat9jZodMN87J7g8rY9t
    error: {"code":-5,"message":"Private key outside allowed range"}
    

    =0xFF....

    importprivkey cWALDjUu1tszsCBMjBjL4mhtjHDZMS5U52WHJ29iqqspZx2Er6J2
    error: {"code":-5,"message":"Private key outside allowed range"}
    

    =n-1

    importprivkey cWALDjUu1tszsCBMjBjL4mhYj2wHUWYDR8Q8aSjLKzjkW5eBtpzu
    (ok)
    

    =n

    importprivkey cWALDjUu1tszsCBMjBjL4mhYj2wHUWYDR8Q8aSjLKzjkWaXMLRaY
    error: {"code":-5,"message":"Private key outside allowed range"}
    
  2. Add check for valid keys in `importprivkey`
    The base58 armoring was checked, but not the resulting private key,
    which could be out of range. Fix this by adding a check.
    c7f9332596
  3. BitcoinPullTester commented at 9:35 AM on January 28, 2014: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/c7f933259623c87a9a3d116cc9bcfd75deb497da for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  4. sipa commented at 9:36 AM on January 28, 2014: member

    ACK, thanks.

  5. wtogami commented at 1:30 PM on January 28, 2014: contributor

    ACK

  6. laanwj referenced this in commit 6ebcec7d3c on Jan 28, 2014
  7. laanwj merged this on Jan 28, 2014
  8. laanwj closed this on Jan 28, 2014

  9. laanwj deleted the branch on Apr 9, 2014
  10. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me