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

Split loading and generating ECC private key c'tors #4437

Merged
merged 2 commits into from
Nov 18, 2024

Conversation

reneme
Copy link
Collaborator

@reneme reneme commented Nov 18, 2024

Currently, the ECC private keys provide two constructors:

  1. taking an AlgorithmIdentifier and key bits
  2. taking an RNG, an EC_Group and an optional secret value as BigInt

The second option either generates a new key or loads the optional secret value within the provided domain. If a user wants to load an ECC private key for which they don't have an AlgorithmIdentifier handy, they have to use this second constructor and "hope" that they'll use it correctly. E.g. by passing a Null_RNG to at least get some error if used incorrectly.

This PR deprecates the second constructor and replaces it by two new ones:

  1. taking an RNG and a domain, to perform a key generation
  2. taking a domain and a secret value, to perform a key loading

Users that never call the now-deprecated constructor with the optional secret value won't ever see the deprecation. Their code will now just bind to the new "generating" constructor. This is achieved by making the secret value mandatory in the now-deprecated constructor.

@reneme reneme added the enhancement Enhancement or new feature label Nov 18, 2024
@reneme reneme requested a review from randombit November 18, 2024 14:26
@reneme reneme self-assigned this Nov 18, 2024
All ECC schemes provided a single constructor for both key gen and key
loading. Its behavior depended on the optional x parameter to be non-zero.
@reneme reneme force-pushed the feature/ecc_constructor branch from 370860d to 4c2132c Compare November 18, 2024 14:36
@coveralls
Copy link

coveralls commented Nov 18, 2024

Coverage Status

coverage: 91.072% (-0.001%) from 91.073%
when pulling be5bbc2 on Rohde-Schwarz:feature/ecc_constructor
into 162a389 on randombit:master.

@reneme
Copy link
Collaborator Author

reneme commented Nov 18, 2024

To be considered: When using the now-deprecated constructor we have access to an RNG. This allows us to do a random blinding when performing the multiplication with the base point, to get the associated public key. The new "key loading" constructor doesn't have an RNG and hence won't be able to use random blinding.

However, the same is true for the existing (and probably much more useful) constructor taking an AlgorithmIdentifier.

@reneme reneme force-pushed the feature/ecc_constructor branch from 2d90f69 to be5bbc2 Compare November 18, 2024 17:27
@randombit
Copy link
Owner

Thanks! I had this on the docket re #4027

Re the removed RNG being used for blinding, indeed I think historically that is the reason for this (kind of weird in retrospect) combined generator-or-load constructor that took an RNG instance.

@reneme reneme merged commit e5ec408 into randombit:master Nov 18, 2024
38 checks passed
@reneme reneme deleted the feature/ecc_constructor branch November 18, 2024 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement or new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants