I need a cryptographic scheme to generate a deterministic chain of private keys that look random to outside observer but can always be reconstructed from a single root key, also:
- Neither private keys nor their corresponding public keys should contain any information about each other.
- In case of some private key leaking it should be impossible to reconstruct the subsequent keys (except for the root private key of course)
Here is my solution:
val privateKey0 = HMAC-SHA256(key: rootPrivateKey, data: "Chain") val privateKey1 = HMAC-SHA256(key: rootPrivateKey ⊕ privateKey0, data: "Chain" || SHA256(privateKey0)) val privateKey2 = HMAC-SHA256(key: rootPrivateKey ⊕ privateKey1, data: "Chain" || SHA256(privateKey1)) ...
Public key is computed as curve point multiplication on EC secp256k1:
val publicKey0 = privateKey0 * G(secp256k1)
Now I'm not a trained cryptographer so I want to ask if this scheme is viable? Are there any obvious flaws? If yes, how can it be improved?