DCIT / perl-CryptX

https://metacpan.org/pod/CryptX
Other
34 stars 23 forks source link

Missing curves #101

Closed tlhackque closed 4 months ago

tlhackque commented 6 months ago

While I understand that it's not recommended for new systems, I ran into sect571r1 (NIST B-571) signatures in a test suite's data.

It's listed in RFC5480 with OID 1.3.132.0.31. (sect571k1 is .38)

Crypt::PK::ECC doesn't have data on this, and is used by Crypt::PKCS10 to provide information about the public key. It is known by OpenSSL. This key (from the test data, found here in 570-ec-sect571r1-request.der) is reported thusly:

openssl ec -noout -text -inform pem -pubin
-----BEGIN PUBLIC KEY-----
MIGnMBAGByqGSM49AgEGBSuBBAAnA4GSAAQCGdEXNGN47Kj6qqbUc97YkgLr0xwP
b1IoDNoFIzOmJEyqHz+0UZbOHaremjO/9Xi2xYOCXYfQ10uM1NRBXomUGfna0kGA
JgIALU86ZrZlKMvposLYkgaJrtwklHumK1b1m/joq5r8NsdwQkyVtl44cucurQz1
UUcoYNJ4ecJv1MWb+I6OwGbiVfM7WSsAhAA=
-----END PUBLIC KEY-----
Public-Key: (570 bit)
pub:
    04:02:19:d1:17:34:63:78:ec:a8:fa:aa:a6:d4:73:
    de:d8:92:02:eb:d3:1c:0f:6f:52:28:0c:da:05:23:
    33:a6:24:4c:aa:1f:3f:b4:51:96:ce:1d:aa:de:9a:
    33:bf:f5:78:b6:c5:83:82:5d:87:d0:d7:4b:8c:d4:
    d4:41:5e:89:94:19:f9:da:d2:41:80:26:02:00:2d:
    4f:3a:66:b6:65:28:cb:e9:a2:c2:d8:92:06:89:ae:
    dc:24:94:7b:a6:2b:56:f5:9b:f8:e8:ab:9a:fc:36:
    c7:70:42:4c:95:b6:5e:38:72:e7:2e:ad:0c:f5:51:
    47:28:60:d2:78:79:c2:6f:d4:c5:9b:f8:8e:8e:c0:
    66:e2:55:f3:3b:59:2b:00:84:00
ASN1 OID: sect571r1
NIST CURVE: B-571

The OpenSSL implementation table is in ec/ec_curve.c

I'm not a crypto expert, but don't see that it would hurt to add both. Since someone put it in the test data and it is in OpenSSL, it was probably in the wild at some point...

I'm not competent (or daring) enough to try to translate the C hex byte arrays into your structures.

karel-m commented 4 months ago

Unfortunately this is a binary field curve which libtomcrypt does not support at the moment. I cannot do much here in CryptX. You can consider opening a feature request in https://github.com/libtom/libtomcrypt (Cc: @sjaeckel)