2
$\begingroup$

I have this ECDSA private key that isn't very important, but I do not have it in any other format.

008AF2DA031B2DC39FBE418A238EFDA3B10ABC7C77FE12A750BFE899

I also need it in public form with a size of 0x3C. I don't know how to start with this. Of course, OpenSSL chokes on it, but that's because it isn't in ASN.1 format, and again I don't know where to start with that.

$\endgroup$
2
  • 1
    $\begingroup$ Is this just the private key number? I hope this is not a real-life entry but rather a dummy for the sake of illustration? About which curve are we talking here? $\endgroup$
    – SEJPM
    Commented Aug 5, 2017 at 13:28
  • $\begingroup$ It's a 28 byte / 224 bit value in hexadecimals, the size requested is 60 bytes, which would mean 4 bytes overhead for, for instance, two ASN.1 encoded integers but without the SEQUENCE. It is however unclear from the question if that would be the acceptable format. Both NIST and Brainpool have 224 bit (prime) curves, of course and there are others. $\endgroup$
    – Maarten Bodewes
    Commented Aug 5, 2017 at 13:37

1 Answer 1

3
$\begingroup$

Without knowing which domain parameters were used this question is impossible to answer. The problem is that the value of the private key is random within the domain.

So although we know that the key size is about 224 bits, there is no way to validate any public key value, because the public key is calculated using the random private key as input in the first place. To be precise, it is the multiplication of the private key with base point $G$ of the curve. This means that we generate a valid public key whichever curve / set of domain parameters we use.

Another issue is the required key size. Normally a public key is identified using a compressed or uncompressed key point. An uncompressed point would add 1 byte for an identifier. However, this in turn is usually put into an ASN.1 BIT STRING, which adds 3 bytes if we assume DER encoding.

So in that case we would for instance get:

033a00046bf056effd0478f8cfe52a07ac42d098f7775314aa84ff4657719c529ce3c117062b42f67b35e2d19276537ea44a14a3b41a072d7fa3c0b7

for P-224 and

033a0004aee24d6692b745b4ecb76d2aff13e51ce177a34f00b5d6c92778d1367dbdb2dd6283fdec3966d33cb800a0e6e5d2060b0daf7e8382e3736e

for brainpoolP224r1, however with no method to distinguish between either two, and there may be more candidates.

Verifying any previously generated signature should of course enable you to select the correct value.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.