change Aes256 to accept buffer

This commit is contained in:
nikola
2024-06-20 12:39:17 +02:00
parent 5e7e4eb40b
commit 9cda42ea4a
7 changed files with 101 additions and 154 deletions

View File

@@ -156,7 +156,7 @@ std::optional<LoginInfoPointer> arg_new_password(Buffer &decrypted_buffer, Buffe
}
add_logininfo_to_buffer(decrypted_buffer, name.c_str(), username.c_str(), password.c_str());
crypto.encrypt(&decrypted_buffer, &encrypted_buffer);
crypto.encrypt(decrypted_buffer, encrypted_buffer);
encrypted_buffer.save_to_file();
Index *index = (Index *)decrypted_buffer.buffer;
return get_logininfo_pointer_from_buffer(decrypted_buffer, index->count - 1);
@@ -181,7 +181,7 @@ void arg_username(Buffer &decrypted_buffer, Buffer &encrypted_buffer, const char
delete_logininfo_from_buffer(decrypted_buffer, pass);
add_logininfo_to_buffer(decrypted_buffer, name.c_str(), username.c_str(), password.c_str());
crypto.encrypt(&decrypted_buffer, &encrypted_buffer);
crypto.encrypt(decrypted_buffer, encrypted_buffer);
encrypted_buffer.save_to_file();
}
@@ -205,7 +205,7 @@ void arg_label_name(Buffer &decrypted_buffer, Buffer &encrypted_buffer, const ch
delete_logininfo_from_buffer(decrypted_buffer, pass);
add_logininfo_to_buffer(decrypted_buffer, name.c_str(), username.c_str(), password.c_str());
crypto.encrypt(&decrypted_buffer, &encrypted_buffer);
crypto.encrypt(decrypted_buffer, encrypted_buffer);
encrypted_buffer.save_to_file();
}
@@ -241,7 +241,7 @@ void arg_delete(Buffer &decrypted_buffer, Buffer &encrypted_buffer, const char *
delete_logininfo_from_buffer(decrypted_buffer, pass);
crypto.encrypt(&decrypted_buffer, &encrypted_buffer);
crypto.encrypt(decrypted_buffer, encrypted_buffer);
encrypted_buffer.save_to_file();
printf("Password deleted\n");
}
@@ -313,7 +313,7 @@ void arg_change(Buffer &decrypted_buffer, Buffer &encrypted_buffer, std::string
}
crypto.change_pass(new_string);
crypto.encrypt(&decrypted_buffer, &encrypted_buffer);
crypto.encrypt(decrypted_buffer, encrypted_buffer);
encrypted_buffer.save_to_file();
printf("Password changed\n");
}
@@ -348,7 +348,7 @@ void arg_file(Buffer &decrypted_buffer, Buffer &encrypted_buffer, const char *la
if (decrypted_buffer.taken <= sizeof(Index))
return;
crypto.encrypt(&decrypted_buffer, &encrypted_buffer);
crypto.encrypt(decrypted_buffer, encrypted_buffer);
encrypted_buffer.save_to_file(save.string());
}