-
Notifications
You must be signed in to change notification settings - Fork 576
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
Split loading and generating ECC private key c'tors #4437
Conversation
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.
370860d
to
4c2132c
Compare
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 |
2d90f69
to
be5bbc2
Compare
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. |
In #4437 new EC private key constructors were added, allowing deprecation of a quite confusing combined keygen/load constructor. However these new constructors take their input as a BigInt rather than the underlying EC_Scalar. Since #4437 has not been included in a release yet we can change these to take EC_Scalar directly, and avoid further entrenchment of BigInt in EC related interfaces.
In #4437 new EC private key constructors were added, allowing deprecation of a quite confusing combined keygen/load constructor. However these new constructors take their input as a BigInt rather than the underlying EC_Scalar. Since #4437 has not been included in a release yet we can change these to take EC_Scalar directly, and avoid further entrenchment of BigInt in EC related interfaces.
Currently, the ECC private keys provide two constructors:
AlgorithmIdentifier
and key bitsEC_Group
and an optional secret value asBigInt
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 aNull_RNG
to at least get some error if used incorrectly.This PR deprecates the second constructor and replaces it by two new ones:
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.