0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-03-10 15:46:48 -04:00
bitcoin-core/src/ecdsa.h

32 lines
843 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-31 17:02:52 +02:00
bool RecomputeR(secp256k1_num_t &r2, const secp256k1_gej_t &pubkey, const secp256k1_num_t &message) const;
bool Verify(const secp256k1_gej_t &pubkey, const secp256k1_num_t &message) const;
2013-03-24 10:38:35 +01:00
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