summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmir Taaki <genjix@riseup.net>2014-04-16 00:34:35 (GMT)
committer Amir Taaki <genjix@riseup.net>2014-04-16 00:35:08 (GMT)
commit9d094411dfa07e69b26ad9f443f0b51c9a1ff2db (patch)
tree180eb3175684d94505febabd11f29a82a883b571
parent682d34e794bd877a3febe3f5b76b4b6c9d12e6d8 (diff)
ability to set compressed of ec key manually/
-rw-r--r--include/bitcoin/utility/elliptic_curve_key.hpp2
-rw-r--r--src/utility/elliptic_curve_key.cpp8
2 files changed, 10 insertions, 0 deletions
diff --git a/include/bitcoin/utility/elliptic_curve_key.hpp b/include/bitcoin/utility/elliptic_curve_key.hpp
index fe1453a..97ecd97 100644
--- a/include/bitcoin/utility/elliptic_curve_key.hpp
+++ b/include/bitcoin/utility/elliptic_curve_key.hpp
@@ -47,6 +47,8 @@ public:
data_chunk public_key() const;
bool verify(hash_digest hash, const data_chunk& signature);
+ void set_compressed(bool compressed);
+
private:
bool initialize();
void use_compressed();
diff --git a/src/utility/elliptic_curve_key.cpp b/src/utility/elliptic_curve_key.cpp
index 1c35168..541300a 100644
--- a/src/utility/elliptic_curve_key.cpp
+++ b/src/utility/elliptic_curve_key.cpp
@@ -180,6 +180,14 @@ bool elliptic_curve_key::verify(hash_digest hash, const data_chunk& signature)
return false;
}
+void elliptic_curve_key::set_compressed(bool compressed)
+{
+ if (compressed)
+ EC_KEY_set_conv_form(key_, POINT_CONVERSION_COMPRESSED);
+ else
+ EC_KEY_set_conv_form(key_, POINT_CONVERSION_UNCOMPRESSED);
+}
+
bool elliptic_curve_key::initialize()
{
// Already initialized