polhenarejos / pico-hsm

Hardware Security Module (HSM) for Raspberry Pico and ESP32
https://www.picokeys.com
GNU General Public License v3.0
236 stars 30 forks source link

Cannot connect to the remote server #60

Closed EdXian closed 1 week ago

EdXian commented 1 week ago

Hi @polhenarejos , I'm intereting to pico-hsm. Now, I'm trying to setup the pico-hsm on my pico2. Howerver, I can't connect to the server when i executed the command python3 tools/pico-hsm-tool.py --pin 648219 initialize --so-pin 57621880. I have seen the similar issue in the history. Is it caused by the remote server is turn-off? Can you help me restart the remote server. thanks a lot!

Pico HSM Tool v2.0
Author: Pol Henarejos
Report bugs to https://github.com/polhenarejos/pico-hsm/issues

********************************
*   PLEASE READ IT CAREFULLY   *
********************************

This tool will erase and reset your device. It will delete all private and secret keys.
Are you sure?
[Press enter to confirm]
Public Point: 00
Traceback (most recent call last):
  File "C:\Users\edwu\Desktop\pico-hsm\tools\pico-hsm-tool.py", line 543, in <module>
    run()
  File "C:\Users\edwu\Desktop\pico-hsm\tools\pico-hsm-tool.py", line 540, in run
    main(args)
  File "C:\Users\edwu\Desktop\pico-hsm\tools\pico-hsm-tool.py", line 518, in main
    initialize(picohsm, args)
  File "C:\Users\edwu\Desktop\pico-hsm\tools\pico-hsm-tool.py", line 230, in initialize
    j = get_pki_data('cvc', data=data)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\edwu\Desktop\pico-hsm\tools\pico-hsm-tool.py", line 165, in get_pki_data
    response = urllib.request.urlopen(req)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2032.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 215, in urlopen
    return opener.open(url, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2032.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 521, in open
    response = meth(req, response)
               ^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2032.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 630, in http_response
    response = self.parent.error(
               ^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2032.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 559, in error
    return self._call_chain(*args)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2032.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 492, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2032.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 639, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 500: Internal Server Error
polhenarejos commented 1 week ago

It seems work to me. Can you try again?

EdXian commented 1 week ago

Sorry ... I still got the same error. Should i set something before initialize the pico-hsm? image

polhenarejos commented 1 week ago

I see the problem. You get Public Point 00, which means is not found.

1) Are you using the firmware specific for your board? 2) Did you nuked your board (formatting flash)? https://github.com/polhenarejos/pico-nuke/releases

EdXian commented 1 week ago

Hello @polhenarejos , I use the pico2(rp2350) released from raspberry pi official. what nuke version should i program for this board? image

I have trird some nuke.uf2. However, the public point is always 00. Thank you!

EdXian commented 1 week ago

Update

  1. I tried to program with pico_nuke_pico2-1.2.uf2 . the onboard led blinked 3 times and then return to bootloader mode. I think it works.

  2. then I program pico_hsm_pico2-5.0.uf2 which is downloaded from here

  3. run python tools/pico-hsm-tool.py --pin 648219 initialize --so-pin 57621880

  4. got the same error... image

polhenarejos commented 1 week ago

Do you have the official Raspberry Pico 2 then?

EdXian commented 1 week ago

Yes, I bought from the reseller who is approved by the raspberry pi foundation here.

polhenarejos commented 1 week ago

I uploaded a new release that fixes this issue.

You have to update:

EdXian commented 1 week ago

It works now! πŸ‘ πŸ‘ πŸ‘ image