diff options
author | Mark Haines <mark.haines@matrix.org> | 2015-03-03 11:18:07 +0000 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2015-03-03 11:18:07 +0000 |
commit | 315caaba7e83eb6680a0407ea13e04b5f7739788 (patch) | |
tree | 23141186153b59f493e9e8e09fc1f207a6f8cee4 /include/axolotl | |
parent | 3ce450fc1984ac480ae158a40d60e9d42f77f74a (diff) |
Add functions for signing and verifying messages using curve25519 keys
Diffstat (limited to 'include/axolotl')
-rw-r--r-- | include/axolotl/crypto.hh | 19 |
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]; |