aboutsummaryrefslogtreecommitdiff
path: root/src/LocalUserEncrypted.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-04-27 04:15:33 +0200
committerdec05eba <dec05eba@protonmail.com>2020-08-18 23:25:46 +0200
commit04cfe9c03baa5691ebfad6e039e4f0acd74fd8e1 (patch)
treeaafcc5450024b1f72dfb8b287b70c4185b890dc6 /src/LocalUserEncrypted.cpp
parent8841ea78fd3386118c7514c89c22fae057cc151a (diff)
Add local user storage function (locally stored encrypted user private key)
Diffstat (limited to 'src/LocalUserEncrypted.cpp')
-rw-r--r--src/LocalUserEncrypted.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/LocalUserEncrypted.cpp b/src/LocalUserEncrypted.cpp
index 1c22488..a414c89 100644
--- a/src/LocalUserEncrypted.cpp
+++ b/src/LocalUserEncrypted.cpp
@@ -7,19 +7,19 @@ namespace odhtdb
EncryptedPrivateKey::EncryptedPrivateKey()
{
memset(nonce, 0, ENCRYPTION_NONCE_BYTE_SIZE);
- memset(encryptedPrivateKey, 0, 16 + PRIVATE_KEY_NUM_BYTES);
+ memset(encryptedPrivateKey, 0, ENCRYPTION_CHECKSUM_BYTE_SIZE + PRIVATE_KEY_NUM_BYTES);
}
EncryptedPrivateKey::EncryptedPrivateKey(const EncryptedPrivateKey &other)
{
memcpy(nonce, other.nonce, ENCRYPTION_NONCE_BYTE_SIZE);
- memcpy(encryptedPrivateKey, other.encryptedPrivateKey, 16 + PRIVATE_KEY_NUM_BYTES);
+ memcpy(encryptedPrivateKey, other.encryptedPrivateKey, ENCRYPTION_CHECKSUM_BYTE_SIZE + PRIVATE_KEY_NUM_BYTES);
}
Signature::PrivateKey EncryptedPrivateKey::decrypt(const DataView &plainPassword, const DataView &salt) const
{
OwnedMemory hashedPassword = hashPassword(plainPassword, salt);
- Decryption decryptedPrivateKey(DataView((void*)encryptedPrivateKey, 16 + PRIVATE_KEY_NUM_BYTES),
+ Decryption decryptedPrivateKey(DataView((void*)encryptedPrivateKey, ENCRYPTION_CHECKSUM_BYTE_SIZE + PRIVATE_KEY_NUM_BYTES),
DataView((void*)nonce, ENCRYPTION_NONCE_BYTE_SIZE),
DataView(hashedPassword.data, hashedPassword.size));
return { (const char*)decryptedPrivateKey.getDecryptedText().data, decryptedPrivateKey.getDecryptedText().size };