diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-03-05 22:45:56 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-08-18 23:25:46 +0200 |
commit | eda9a7bbefc5587bf1ff895a9214f450e64575fa (patch) | |
tree | 0f968fb7373a29cf116b4b6d473a966e28e62825 /src/Signature.cpp | |
parent | 33e823ddddddd4a13b1a05b90ae5b419b89bcb1d (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.cpp | 6 |
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"); } } |