Skip to content
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

PrivateKey parameters and RFC 5915 #123

Closed
richardschneider opened this issue Dec 27, 2017 · 4 comments
Closed

PrivateKey parameters and RFC 5915 #123

richardschneider opened this issue Dec 27, 2017 · 4 comments

Comments

@richardschneider
Copy link

richardschneider commented Dec 27, 2017

The PrivateKey.parameters produced by privateKeyExport currently contain the curve parameters. According to RFC 5915 section 3, it should contain the curve name (OID).

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

SEQUENCE(4 elem)
  INTEGER 1
  OCTET STRING(32 byte) FD1DFE200F8133418031877BF9B54A816D9066011C426ACD46E1B8C16863FEA9
  [0](1 elem)
     OBJECT IDENTIFIER 1.3.132.0.10 secp256k1 (SECG (Certicom) named elliptic curve)
  [1](1 elem)
     BIT STRING(264 bit) 0000001110001111011111001101110011101011001100011011010111110010001101…

Actual

SEQUENCE(4 elem)
  INTEGER 1
  OCTET STRING(32 byte) FD1DFE200F8133418031877BF9B54A816D9066011C426ACD46E1B8C16863FEA9
  [0](1 elem)
    SEQUENCE(6 elem)
      INTEGER 1
      SEQUENCE(2 elem)
        OBJECT IDENTIFIER 1.2.840.10045.1.1 prime-field (ANSI X9.62 field type)
        INTEGER(256 bit) 1157920892373161954235709850086879078532699846656405640394575840079088…
     SEQUENCE(2 elem) 
       OCTET STRING(1 byte) 00
       OCTET STRING(1 byte) 07
     OCTET STRING(33 byte) 0279BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798
     INTEGER(256 bit) 1157920892373161954235709850086879078528375642790749043826051631415181…
     INTEGER 1
  [1](1 elem)
     BIT STRING(264 bit) 0000001110001111011111001101110011101011001100011011010111110010001101…
@richardschneider
Copy link
Author

richardschneider commented Dec 27, 2017

Thanks @fanatid for the fast response. So, should I raise the issue with bitcoin-core/secp256k1, or will you guys do it?

@fanatid
Copy link
Member

fanatid commented Dec 27, 2017

yes, please create issue in bitcoin-core/secp256k1
if they accept it and change ec_privkey_export_der, I'll change this lib

@fanatid
Copy link
Member

fanatid commented Dec 3, 2019

I'll close it because issue was closed in bitcoin-core/secp256k1.

@fanatid fanatid closed this as completed Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants