Skip to content

Conversation

@karel-m
Copy link
Member

@karel-m karel-m commented Jun 5, 2018

When trying to load the following EC / DER key (generated by openssl):

3081be
   0201 01
   0415 00c78b055db0706fd86b5a15e14b9e51f0043d18f9
   a074
      3072
         0201 01
         3020
            0607 2a8648ce3d0101
            0215 00fffffffffffffffffffffffffffffffeffffac73
            3006
              0401 00
              0401 07
            0429 043b4c382ce37aa192a4019e763036f4f5dd4d7ebb938cf935318fdced6bc28286531733c3f03c4fee
            0215 0100000000000000000001b8fa16dfab9aca16b6b3
            0201 01
   a12c
      032a 00040ca9f03d79907c97538177a3027970abefa351073a73120e1b5d2dab02dde37c118a44f8cb267b56

I have found out that the private key:

  • 0415 = LTC_ASN1_RAW_BIT_STRING
  • value 00c78b055db0706fd86b5a15e14b9e51f0043d18f9 (21 bytes)

is for some reason 1 byte longer (21 bytes) than the curve size (20 bytes).

Therefore I have removed the test inlen <= key->dp.size (not sure if this is not too relaxed, perhaps we can check whether key->k < prime or something like that)

@karel-m karel-m requested a review from sjaeckel June 5, 2018 15:02
@karel-m karel-m force-pushed the pr/fix-ecc_set_key branch from f9cdb84 to 0c629e9 Compare June 5, 2018 16:21
@karel-m karel-m added this to the next milestone Jun 7, 2018
@karel-m karel-m force-pushed the pr/fix-ecc_set_key branch from 0c629e9 to 70d800f Compare June 10, 2018 15:30
@karel-m karel-m merged commit d11a1a7 into develop Jun 10, 2018
@karel-m karel-m deleted the pr/fix-ecc_set_key branch June 10, 2018 17:06
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.

3 participants