secp256k1-zkp/src/ecdsa.h

32 lines
837 B
C
Raw Normal View History

2013-03-10 05:34:04 +01:00
#ifndef _SECP256K1_ECDSA_
#define _SECP256K1_ECDSA_
namespace secp256k1 {
class Signature {
private:
2013-03-24 10:38:35 +01:00
secp256k1_num_t r,s;
2013-03-10 05:34:04 +01:00
public:
2013-03-24 10:38:35 +01:00
Signature() {
secp256k1_num_init(&r);
secp256k1_num_init(&s);
}
~Signature() {
secp256k1_num_free(&r);
secp256k1_num_free(&s);
}
2013-03-16 15:51:55 +01:00
bool Parse(const unsigned char *sig, int size);
2013-03-18 02:41:01 +01:00
bool Serialize(unsigned char *sig, int *size);
2013-03-24 10:38:35 +01:00
bool RecomputeR(secp256k1_num_t &r2, const GroupElemJac &pubkey, const secp256k1_num_t &message) const;
bool Verify(const GroupElemJac &pubkey, const secp256k1_num_t &message) const;
bool Sign(const secp256k1_num_t &seckey, const secp256k1_num_t &message, const secp256k1_num_t &nonce);
void SetRS(const secp256k1_num_t &rin, const secp256k1_num_t &sin);
2013-03-16 15:51:55 +01:00
std::string ToString() const;
2013-03-10 05:34:04 +01:00
};
}
#endif