Initializing public ECC key and checking signature

31 views
Skip to first unread message

Robert Zillner

unread,
Oct 1, 2014, 10:14:42 AM10/1/14
to cryptop...@googlegroups.com
Hello everyone,

may someone help me with checking a signature using crypto++.

My situation:

1. A mesage is signed externally using an ATECC108 chip (K283 curve).
2. The public key is available as 2 byte atrrays (36 byte X and 36 byte Y component).
3. Initializing a public key in crypto++ throws an error on validating the public key "CryptoMaterial: this object contains invalid values"

i´m using this code to check a signature


PolynomialMod2 X(pubKey, 36);
PolynomialMod2 Y(&pubKey[36], 36);
EC2N::Point D(X, Y);

ECDSA<EC2N, SHA256>::PublicKey pKey;
pKey.Initialize(oid, D);

result = pKey.Validate( prng, 3);
if( !result )
{
      cout << "Validation of public key failed !!!" << endl;
}

StringSource sss(signature+message, true,
 new SignatureVerificationFilter(
     ECDSA<EC2N,SHA256>::Verifier(pKey),
     new ArraySink( (byte*)&result, sizeof(result) )
 ) // SignatureVerificationFilter
);

if( !result )
{
  cout << "Signature check failed !!!" << endl;
}
else
{
  cout << "Signature check succeed !!!" << endl;
}


Using the crypto++ library to sign and to check works fine, but initializing and using a public key goes wrong.

Can anyone help?

BR

Robert

Robert Zillner

unread,
Oct 2, 2014, 7:23:04 AM10/2/14
to cryptop...@googlegroups.com
Update:

The external public key is now accepted.
The only thing not working is the signature test itself.

StringSource verify(message+signature, true,
 new SignatureVerificationFilter(
     ECDSA<EC2N,SHA256>::Verifier(pKey),
     new ArraySink( (byte*)&result, sizeof(result) )
 ) // SignatureVerificationFilter
);
// Verification failure?
if(!result)
{
     cout << "Signature check failed !!!\r" << endl;
}
else
{
     cout << "Signature check succeed !!!\r" << endl;
}
Reply all
Reply to author
Forward
0 new messages