hiero-ledger / hiero-ledger/hiero-consensus-node
Fail early/fast if the private key loaded doesn't match the public key in the roster for the node
- Dominant language
- Java
- Stars
- 406
- Forks
- 226
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 210
Description
This is the follow up for #17308 based on the comment: `https://github.com/hiero-ledger/hiero-consensus-node/pull/22927#discussion_r2713475394`
Currently, there is a check in the `PlatformBuilder#withKeysAndCerts` to verify that the platform has a valid signing cert that matches the signing private key. Similar check should be added to the `EnhancedKeyStoreLoader`, whether its in the `scan()` step or in the `verify()` step, validating the private key against the public key that is in the roster, so that the call to `CryptoStatic.initNodeSecurity()` shouldn't succeed if there is misalignment between the private key loaded from disk and the public key in the roster. `EnhancedKeyStoreLoaderTest` resources (private keys) should also be revisited in the scope of this issue, because once this validation is added, tests in this class will begin to fail.
Contributor guide
Research direction
Start with EnhancedKeyStoreLoader and its verify() and scan() steps, comparing the existing PlatformBuilder#withKeysAndCerts check. Review EnhancedKeyStoreLoaderTest and its private-key resources, then run that test to identify affected cases. Done means CryptoStatic.initNodeSecurity() rejects a disk private key that does not match the roster public key, while the test resources and tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- cryptography, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100