Blockstream / blind_pin_server

MIT License
13 stars 10 forks source link

Refuse to start when invalid `server_private_key.key` #22

Closed RCasatta closed 11 months ago

RCasatta commented 1 year ago

It looks providing a 0 bytes server_private_key.key causes the pin server to avoid creating a random key and use the provided one, however 0 bytes are not enough entropy :)

I think when the file is shorter than 16 bytes should refuse to start

jgriffiths commented 1 year ago

Not only that, it should verify the private key is valid a-la wally_ec_private_key_verify

JamieDriver commented 1 year ago

yy atm the key isn't loaded (and checked with ec_private_key_verify() as suggested) until it is used - ie when the first call comes in.
And yes, the server spits an error 500 (internal error) but otherwise continues running.

Agree, it would be friendlier to check that at startup and refuse to run if it's only going to error every request anyway! Cheers guys.