0
$\begingroup$

I have a list of the random values (each 65 bytes long). One of the items is a private key which is used to sign the data:

Private key = KeyFactory.getInstance("EC").generatePrivate(
  new ECPrivateKeySpec(new BigInteger(<ONE OF THE ITEM FROM THE LIST>), ECNamedCurveTable.getParameterSpec("SECP521R1"))
);

Signature sig = Signature.getInstance("SHA256withECDSA");
sig.initSign(key);
sig.update(<data to sign>)
sig.sign();

I have no access to the correspond public key nor result of the sign().

Is there any way to find of which item on the list is a valid private key? I know that only one value is a private key.

Is a ECC private key random value? Or maybe it has a "structure" which can be used to distinguish it from other random values?

$\endgroup$
  • $\begingroup$ What is the aim here? Is it a CTF or homework? Hint: the private key is a random integer. If your random integer generator is not good then you can distinguish. $\endgroup$ – kelalaka Sep 25 at 8:59
  • $\begingroup$ It is a critical assumption in my code. I would like to make sure it is correct. Thank you for the hint. $\endgroup$ – Dariusz Sep 25 at 9:14
  • 2
    $\begingroup$ Private keys are generally a random value between $0$ and the order $q$ of the subgroup. If $q$ if far from a power of $2$, then the private keys will also be relatively far from this power of $2$. In the case of curve P-521, $q$ is very close to $2^{521}$, so random values have a high probability to be inferior to $q$ and hard to distinguish from private keys. $\endgroup$ – corpsfini Sep 25 at 9:27
  • $\begingroup$ @corpsfini That would be an answer I suppose $\endgroup$ – Maarten Bodewes Sep 25 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.