-
Notifications
You must be signed in to change notification settings - Fork 577
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
Unable to Load Certain EC Keys in Botan 3.6+ #4539
Comments
Interestingly this encoding bug was fixed in #4110 but what I failed to realize at the time is, thinking that the bug had been introduced in #4056 and had never been in a release. But in fact we were always encoding incorrectly prior to #4056 as well
Using the size of the key vs using the size of the group order as it should have been. :/ |
Are you sure about the version timeline? As best I can tell the encoding was fixed in 3.5.0. |
Oh, I see. Would still be great if there would be an API option to somehow import the old keys in 3.6+. |
Starting in 3.6.0 a logic change started rejecting EC keys where the byte encoding is shorter than required. Most implementations including OpenSSL accept such keys. GH #4539
We just have to support this in the default codepath. It might be a different story had this been done correctly the whole time, but it wasn't. Can you try the patch in #4541 |
Starting in 3.6.0 a logic change started rejecting EC keys where the byte encoding is shorter than required. Most implementations including OpenSSL accept such keys. GH #4539
Starting in 3.6.0 a logic change started rejecting EC keys where the byte encoding is shorter than required. Most implementations including OpenSSL accept such keys. GH #4539
I thought that throwing an error when loading a short private key via the default function may be desirable, hence my comment about the API option. However, #4541 works perfectly. Thanks! |
When generating EC keys prior to version 3.6, the private key byte size is not stretched to match the byte size of the curve order. In Botan 3.6+, EC keys will not be loaded if these sizes do not match:
botan/src/lib/pubkey/ec_group/ec_inner_data.cpp
Lines 245 to 248 in 440b645
This issue occurs 50% of the time when generating keys for
secp521r1
, as 521 mod 8 = 1. When generating an example key with Botan 3.5 or below, which has a byte size of 65:Attempting to load the key in Botan 3.6 results in an error:
The text was updated successfully, but these errors were encountered: