Skip to content

fix: handle public-only Bip32ECKeyPair to avoid NullPointerException in deriveChildKey#2284

Open
Dev10-sys wants to merge 2 commits into
LFDT-web3j:mainfrom
Dev10-sys:fix/bip32-public-key-derive-npe
Open

fix: handle public-only Bip32ECKeyPair to avoid NullPointerException in deriveChildKey#2284
Dev10-sys wants to merge 2 commits into
LFDT-web3j:mainfrom
Dev10-sys:fix/bip32-public-key-derive-npe

Conversation

@Dev10-sys

Copy link
Copy Markdown
Contributor

This fixes a NullPointerException when deriving child keys from a Bip32ECKeyPair created with only a public key.

Previously, getPublicKeyPoint() always tried to derive the public point from the private key, which caused a crash when the private key was null.

Now, if the private key is not present, the public key is used to reconstruct the ECPoint directly.

A test case has been added to verify that public-only keypairs no longer throw an exception during derivation.

Fixes #1927

…p32ECKeyPair

Signed-off-by: Dev10-sys <kalpanagola9897@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A Bip32ECKeyPair generated with a public key, the method deriveChildKey gets "NullPointerException"

1 participant