aboutsummaryrefslogtreecommitdiff
path: root/src/Signature.cpp
diff options
context:
space:
mode:
authorAleksi Lindeman <0xdec05eba@gmail.com>2018-03-05 22:45:56 +0100
committerAleksi Lindeman <0xdec05eba@gmail.com>2018-03-05 22:48:26 +0100
commit2ffb47d0043e57707474e5ae811f97c2e5e93f25 (patch)
treefd60b300cdf736de5adc68b395105dcfc6a43f09 /src/Signature.cpp
parent66661e47dc826f50b690e080057f47a0ea27016c (diff)
Implement 'create' operation, add seeding
Seeding is currently only done on the key you specify, in the future the user should request data that it can seed.
Diffstat (limited to 'src/Signature.cpp')
-rw-r--r--src/Signature.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Signature.cpp b/src/Signature.cpp
index 8d3654d..34f6190 100644
--- a/src/Signature.cpp
+++ b/src/Signature.cpp
@@ -42,7 +42,7 @@ namespace odhtdb
string result;
result.resize(signedMessage.size - SIGNED_HASH_SIZE);
- if(crypto_sign_ed25519_open((unsigned char*)&result[0], nullptr, (const unsigned char*)signedMessage.data, signedMessage.size, (unsigned char*)data) != 0)
+ if(crypto_sign_ed25519_open((unsigned char*)&result[0], nullptr, (const unsigned char*)signedMessage.data, signedMessage.size, (unsigned char*)data) < 0)
throw UnsignWrongKeyException("Message was not signed with matching private key");
return result;
@@ -86,7 +86,7 @@ namespace odhtdb
result.resize(crypto_sign_ed25519_BYTES + dataToSign.size);
unsigned long long resultSize;
- if(crypto_sign_ed25519((unsigned char*)&result[0], &resultSize, (unsigned char*)dataToSign.data, dataToSign.size, (unsigned char*)data) != 0)
+ if(crypto_sign_ed25519((unsigned char*)&result[0], &resultSize, (unsigned char*)dataToSign.data, dataToSign.size, (unsigned char*)data) < 0)
throw DataSignException("Failed to sign data. Is private key invalid?");
if(resultSize != result.size())
@@ -105,7 +105,7 @@ namespace odhtdb
KeyPair::KeyPair()
{
- if(crypto_sign_ed25519_keypair((unsigned char*)publicKey.data, (unsigned char*)privateKey.data) != 0)
+ if(crypto_sign_ed25519_keypair((unsigned char*)publicKey.data, (unsigned char*)privateKey.data) < 0)
throw SignatureGenerationException("Failed to generate signature keypair");
}
}