add parsing of ECC group from ECC parameters#5532
Conversation
|
Change looks fine, needs some test cases though |
| #include <botan/x509_key.h> | ||
| #include <botan/internal/fmt.h> | ||
| #include <botan/internal/stl_util.h> | ||
| #if defined(BOTAN_HAS_ECC_PUBLIC_KEY_CRYPTO) |
There was a problem hiding this comment.
This is not an appropriate file for this test - test_pubkey.cpp is test infrastructure for public key algorithms
For example it would be appropriate in this file to add PK_Private_Key_Decoding_Test base class and then deriving it somewhere for your actual test.
Considering the test is already hard coded to ECDH keys might as well be in test_ecdh.cpp I suppose.
There was a problem hiding this comment.
Actually we already have exactly such a generic test - PK_Key_Decoding_Test which doesn't even need to be derived from it just reads from src/tests/data/pubkey/key_encoding.vec
The only issue is that right now this test only handles valid keys and not invalid. This should be easy to extend by adding a [Valid] header for the current test data plus [Invalid] which inverts the success/fail logic.
There was a problem hiding this comment.
Actually we already have exactly such a generic test -
PK_Key_Decoding_Testwhich doesn't even need to be derived from it just reads fromsrc/tests/data/pubkey/key_encoding.vec
The existing test is different. It decodes a complete private key info structure, that is not working for the intended test. I will thus create a new one in the test_ecdh.cpp.
There was a problem hiding this comment.
@randombit
I think I addressed all your review comments now. Could you check it again?
|
@randombit handles the alg_id: it never looks at the OID, only checks for the presence of parameters. A caller that calls the function with a specific algorithm identifier might expect the function to check that I also think that to make the interface clearer, passing |
Not helpful since this is generic across algorithms this could also be SM2, ECKCDSA, GOST, ... |
a68b2fb to
9d15494
Compare
41f78dd to
c107b1d
Compare
c107b1d to
54200e6
Compare
Tasks:
test_ecdh.cpp