Pergunta

I'm implementing ECDSA in C# using the BouncyCastle library and I'm having a hard time understanding TestECDsa192bitPrime() example.

FpCurve curve = new FpCurve(
  new BigInteger(
    "6277101735386680763835789423207666416083908700390324961279"), // q
  new BigInteger(
    "fffffffffffffffffffffffffffffffefffffffffffffffc", 16), // a
  new BigInteger(
    "64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1", 16)); // b

ECDomainParameters parameters = new ECDomainParameters(curve,
  curve.DecodePoint(Hex.Decode(
    "03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012")), // G
    new BigInteger(
      "6277101735386680763835789423176059013767194773182842284081")); // n

ECPrivateKeyParameters priKey = new ECPrivateKeyParameters(
  "ECDSA",
  new BigInteger(
    "651056770906015076056810763456358567190100156695615665659"), // d
  parameters);

ParametersWithRandom param = new ParametersWithRandom(priKey, k);
ECDsaSigner ecdsa = new ECDsaSigner();
ecdsa.Init(true, param);
curve.DecodePoint(Hex.Decode(
  "0262b12d60690cdcf330babab6e69763b471f994dd702d16a5")), // Q
  parameters);

In the above example how BouncyCastle directly calculated G( Basepoint) and Q( public key).

Foi útil?

Solução

This is a test to ensure signature process is correct. The values of G and Q were taken from X9.62 standard from 1998, section J.3.1, page 152, ECDSA over the field Fp, an example with 192 bit prime.

This paper is not public, but the same values can be found on page 26 of Mathematical routines for the NIST prime elliptic curves paper.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top