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

k256: fallible AffinePoint to VerifyingKey conversion #535

Merged

Conversation

tarcieri
Copy link
Member

The inner type of VerifyingKey is a PublicKey, which is itself a wrapper for an inner curve-specific AffinePoint which ensures that the inner point is NOT the additive identity / point at infinity.

Therefore, any conversion from an AffinePoint is potentially fallible, so the existing From conversions need to be changed to TryFrom.

This commit also adds some additional type conversions between AffinePoint/ProjectivePoint and PublicKey/VerifyingKey, and also includes them in p256 for consistency.

@tarcieri tarcieri mentioned this pull request Mar 16, 2022
@tarcieri tarcieri force-pushed the k256/fallible-affine-point-to-verifying-key-conversion branch from 9a78034 to 85a2c95 Compare March 16, 2022 17:28
The inner type of `VerifyingKey` is a `PublicKey`, which is itself a
wrapper for an inner curve-specific `AffinePoint` which ensures that the
inner point is *NOT* the additive identity / point at infinity.

Therefore, any conversion from an `AffinePoint` is potentially fallible,
so the existing `From` conversions need to be changed to `TryFrom`.

This commit also adds some additional type conversions between
`AffinePoint`/`ProjectivePoint` and `PublicKey`/`VerifyingKey`, and also
includes them in `p256` for consistency.
@tarcieri tarcieri force-pushed the k256/fallible-affine-point-to-verifying-key-conversion branch from 85a2c95 to a1699af Compare March 16, 2022 23:28
@tarcieri tarcieri merged commit 75381fd into master Mar 17, 2022
@tarcieri tarcieri deleted the k256/fallible-affine-point-to-verifying-key-conversion branch March 17, 2022 00:05
@tarcieri tarcieri mentioned this pull request May 9, 2022
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.

1 participant