aboutsummaryrefslogtreecommitdiff
path: root/src/Encryption.cpp
diff options
context:
space:
mode:
authordec05eba <0xdec05eba@gmail.com>2018-04-27 04:15:33 +0200
committerdec05eba <0xdec05eba@gmail.com>2018-04-27 04:15:38 +0200
commitcd4ff393e72331195687c1223aaaa432be3e5d0e (patch)
treea5f1b24ae2201d59b200004dc1a7b0274c198162 /src/Encryption.cpp
parentf2936e0e081de82dedf5f437f84d99debea49027 (diff)
Add local user storage function (locally stored encrypted user private key)
Diffstat (limited to 'src/Encryption.cpp')
-rw-r--r--src/Encryption.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Encryption.cpp b/src/Encryption.cpp
index e67c719..1d6bfc0 100644
--- a/src/Encryption.cpp
+++ b/src/Encryption.cpp
@@ -7,8 +7,8 @@ namespace odhtdb
{
Encryption::Encryption(const DataView &data, const DataView &additionalData, const DataView &_key)
{
- cipherText = new unsigned char[crypto_aead_xchacha20poly1305_ietf_ABYTES + data.size];
cipherTextLength = crypto_aead_xchacha20poly1305_ietf_ABYTES + data.size;
+ cipherText = new unsigned char[cipherTextLength];
if(_key.data)
{
@@ -46,8 +46,8 @@ namespace odhtdb
Decryption::Decryption(const DataView &data, const DataView &nonce, const DataView &key)
{
- decryptedText = new unsigned char[data.size];
decryptedTextLength = data.size;
+ decryptedText = new unsigned char[decryptedTextLength];
if(nonce.size < ENCRYPTION_NONCE_BYTE_SIZE)
throw DecryptionException("Nonce is not big enough");