template class xf::security::ecdsaSecp256k1¶
#include "ecdsa.hpp"
Overview¶
Elliptic Curve Digital Signature Algorithm on curve secp256k1. This class provide signing and verifying functions.
Parameters:
HashW | Bit Width of digest that used for signting and verifying. |
template <int HashW> class ecdsaSecp256k1: public xf::security::ecc // fields ap_uint <256> Gx ap_uint <256> Gy ap_uint <256> n
Fields¶
ap_uint <256> Gx
X coordinate of generation point of curve secp256k1.
ap_uint <256> Gy
Y coordinate of generation point of curve secp256k1.
ap_uint <256> n
Order of curve secp256k1.
Methods¶
generatePubKey¶
void generatePubKey ( ap_uint <256> privateKey, ap_uint <256>& Qx, ap_uint <256>& Qy )
Generate Public Key point Q from private key.
Parameters:
privateKey | Private Key. |
Qx | X coordinate of point Q. |
Qy | Y coordinate of point Q. |
sign¶
bool sign ( ap_uint <HashW> hash, ap_uint <256> k, ap_uint <256> privateKey, ap_uint <256>& r, ap_uint <256>& s )
signing function. It will return true if input parameters are legal, otherwise return false.
Parameters:
hash | Digest value of message to be signed. |
k | A random key to sign the message, should kept different each time to be used. |
privateKey | Private Key to sign the message |
r | part of signing pair {r, s} |
s | part of signing pair {r, s} |
verify¶
bool verify ( ap_uint <256> r, ap_uint <256> s, ap_uint <HashW> hash, ap_uint <256> Px, ap_uint <256> Py )
verifying function. It will return true if verified, otherwise false.
Parameters:
r | part of signing pair {r, s} |
s | part of signing pair {r, s} |
hash | Digest value of message to be signed. |
Px | X coordinate of public key point P. |
Py | Y coordinate of public key point P. |