From 04cfe9c03baa5691ebfad6e039e4f0acd74fd8e1 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 27 Apr 2018 04:15:33 +0200 Subject: Add local user storage function (locally stored encrypted user private key) --- src/Encryption.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Encryption.cpp') 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"); -- cgit v1.2.3