Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cryptoScalarMult takes inputs in the wrong order #129

Open
timmc opened this issue Sep 9, 2023 · 1 comment
Open

cryptoScalarMult takes inputs in the wrong order #129

timmc opened this issue Sep 9, 2023 · 1 comment

Comments

@timmc
Copy link
Contributor

timmc commented Sep 9, 2023

DiffieHellman.Lazy.cryptoScalarMult accepts parameters named publicKey, secretKey, but the underlying implementation expects the secret key first. If you use the documented argument order, key agreement doesn't work.

Key cryptoScalarMult(Key publicKey, Key secretKey);

@timmc
Copy link
Contributor Author

timmc commented Sep 9, 2023

Relatedly, it also might be wise to create subclasses of Key with names like SodiumBoxPublicKey. Even if the method is documented correctly, having everything be called Key makes it easy for a caller to mess up. (I'd be happy to submit a PR for this, as I've done something similar in my own use of lazysodium.)

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

No branches or pull requests

1 participant