Skip to content

crypto: add generatePublicKey to ECDH, fix corner cases

Rodrigo Muino Tomonari requested to merge github/fork/Trott/ecdh-fixes into master

This is #1020 rebased against master and with the nits fixed up.

From original PR:

ECDH.generatePublicKey can get the public key using the curve and private key. This allows usage of the crypto module where a developer imports a private key, and then generates a public key without needing it stored.

Removed the generated_ boolean from the ECDH class, and stopped checking for it with getPrivateKey() and getPublicKey(). This allows you to import public and private keys without having to generate first, which would just rewrite the generated keys regardless.

An error message was changed to accurately reflect what the error was.

Merge request reports

Loading