The PrivateKey.parameters
produced by ec_privkey_export_der
currently contain the curve parameters. According to RFC 5915 section 3, it should contain the curve name (OID).
Is it possible to change this method, or add a ec_privkey.export_RFC5480
parameters specifies the elliptic curve domain parameters associated to the private key. The type ECParameters is discussed in [RFC5480]. As specified in [RFC5480], only the namedCurve CHOICE is permitted. namedCurve is an object identifier that fully identifies the required values for a particular set of elliptic curve domain parameters. Though the ASN.1 indicates that the parameters field is OPTIONAL, implementations that conform to this document MUST always include the parameters field.
Expected
0SEQUENCE(4 elem)
1 INTEGER 1
2 OCTET STRING(32 byte) FD1DFE200F8133418031877BF9B54A816D9066011C426ACD46E1B8C16863FEA9
3 [0](1 elem)
4 OBJECT IDENTIFIER 1.3.132.0.10 secp256k1 (SECG (Certicom) named elliptic curve)
5 [1](1 elem)
6 BIT STRING(264 bit) 0000001110001111011111001101110011101011001100011011010111110010001101…
Actual
0SEQUENCE(4 elem)
1 INTEGER 1
2 OCTET STRING(32 byte) FD1DFE200F8133418031877BF9B54A816D9066011C426ACD46E1B8C16863FEA9
3 [0](1 elem)
4 SEQUENCE(6 elem)
5 INTEGER 1
6 SEQUENCE(2 elem)
7 OBJECT IDENTIFIER 1.2.840.10045.1.1 prime-field (ANSI X9.62 field type)
8 INTEGER(256 bit) 1157920892373161954235709850086879078532699846656405640394575840079088…
9 SEQUENCE(2 elem)
10 OCTET STRING(1 byte) 00
11 OCTET STRING(1 byte) 07
12 OCTET STRING(33 byte) 0279BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798
13 INTEGER(256 bit) 1157920892373161954235709850086879078528375642790749043826051631415181…
14 INTEGER 1
15 [1](1 elem)
16 BIT STRING(264 bit) 0000001110001111011111001101110011101011001100011011010111110010001101…
This was first raised in https://github.com/cryptocoinjs/secp256k1-node/issues/123