Skip to content
This repository has been archived by the owner on Nov 29, 2021. It is now read-only.

ECKFTag methods are misnamed? #197

Open
fiadliel opened this issue Aug 29, 2018 · 2 comments
Open

ECKFTag methods are misnamed? #197

fiadliel opened this issue Aug 29, 2018 · 2 comments

Comments

@fiadliel
Copy link
Contributor

Some comments on methods in ECKFTag:

buildPrivateKeyFromPoint/unsafeBuildPrivateKeyFromPoint delegate to java.security.spec.ECPrivateKeySpec, and the parameter passed is "the private value S". This is a secret value, not a point, so the method are misnamed.

unsafeBuildPublicKeyFromPoints delegates to java.security.spec.ECPublicKeySpec, and the parameters passed in are the affine x-coordinate and affine y-coordinate of the public point of the curve. Since we are passing in the coordinates of a single point, not multiple points, this method is also misnamed.

One more thing to note: there is a lack of symmetry between buildPublicKey and unsafeBuildPublicKeyFromPoints, since in most other cases, unsafe is appended to another method name without any other changes.

@jmcardon
Copy link
Owner

You're right and naming is hard.

@jmcardon
Copy link
Owner

Also, to be honest, tsec 0.1 should really revamp these to just return Option.

Majority of these unsafeBlah is just laziness on my part when I wrote them months ago. There's no real observable side effect from doing this, despite forcing a try/catch

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants