From cd4ff393e72331195687c1223aaaa432be3e5d0e Mon Sep 17 00:00:00 2001 From: dec05eba <0xdec05eba@gmail.com> 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