How do I derive a child key pair from a master key pair? #839
Replies: 1 comment
-
The key derivation functions in Elliptic curve keys and RSA have specific structures so a random-like byte string can't be interpreted directly as such kind of keys (with a few exceptions, see below). There are a few ways to do that. If your derived key must be an Ed25519 key, you can use a KDF to derive 32 bytes and have that imported as an Ed25519 key with If your derived key must be an X25519 key, you can use (similar functions exist for Ed448 and X448) If your derived key must be a NIST P ECC key or an RSA key, you can use the derived key (byte string) as data for a XOF (like |
Beta Was this translation helpful? Give feedback.
-
I'm trying to create a functional replica of the Bitcoin protocol, albeit at a smaller scale, for an academic project, and I'm trying to generate a unique address for each transaction. According to this answer,
https://bitcoin.stackexchange.com/a/48325/160205
How do I derive such "additional private keys"?
I tried using bcrypt on the master key according to this example
https://www.pycryptodome.org/src/protocol/kdf#bcrypt
and then tried using RSA.import_key() to convert the hash to a new key, for which I got the error
ValueError: RSA key format is not supported
, which, in hindsight, would obviously have never worked as that function is to be used for importing already exported, valid keys.Beta Was this translation helpful? Give feedback.
All reactions