aboutsummaryrefslogtreecommitdiff
path: root/include/axolotl/crypto.hh
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-03-03 11:18:07 +0000
committerMark Haines <mark.haines@matrix.org>2015-03-03 11:18:07 +0000
commit315caaba7e83eb6680a0407ea13e04b5f7739788 (patch)
tree23141186153b59f493e9e8e09fc1f207a6f8cee4 /include/axolotl/crypto.hh
parent3ce450fc1984ac480ae158a40d60e9d42f77f74a (diff)
Add functions for signing and verifying messages using curve25519 keys
Diffstat (limited to 'include/axolotl/crypto.hh')
-rw-r--r--include/axolotl/crypto.hh19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/axolotl/crypto.hh b/include/axolotl/crypto.hh
index 162099f..d772f46 100644
--- a/include/axolotl/crypto.hh
+++ b/include/axolotl/crypto.hh
@@ -48,6 +48,25 @@ void curve25519_shared_secret(
);
+/** Signs the message using our private key.
+ * The output buffer must be at least 64 bytes long. */
+void curve25519_sign(
+ Curve25519KeyPair const & our_key,
+ std::uint8_t const * message, std::size_t message_length,
+ std::uint8_t * output
+);
+
+
+/** Verify thei message using their public key.
+ * The signature input buffer must be 64 bytes long.
+ * Returns true if the signature is valid. */
+bool curve25519_verify(
+ Curve25519PublicKey const & their_key,
+ std::uint8_t const * message, std::size_t message_length,
+ std::uint8_t const * signature
+);
+
+
struct Aes256Key {
static const int LENGTH = 32;
std::uint8_t key[32];