-
Notifications
You must be signed in to change notification settings - Fork 242
Description
MC's ed25519 library is a 2013 implementation by Orson Peters -- while it generates new keypairs from a 32-byte seed as normal, the representation it uses for the private key is the sha512 of the seed after cofactor clamping. This works, but few if any modern ed25519 libraries are compatible with that representation. Most just use the seed, or a few use the right half of the sha512 before clamping, neither of which are possible using the keys stored by the current MC firmware.
This mostly matters to loggers like mctomqtt, which do a get prv.key to obtain the secret key so they can decode the raw packets, and are thus very constrained in what crypto libraries they can use (mctomqtt shells out to a Node implementation of a WASM build of Peters' library).
Please consider preserving the original seed, and making it available via the CLI. I'll send a PR that implements this. It won't help nodes already deployed with current keys (their seeds are long gone) but loggers will generally be able well connected and able to regen their keys if they need the functionality.
Background:
- https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/ (writeup on some of the various definitions of "private key" used since the original team's reference implementation)
- Example ed25519 APIs in Python, Rust and Go