Account Parser::parse_account(std::string const &chunk, std::string const &encryption_key) { std::istringstream s(chunk); // TODO: Get rid of the copy! auto id = read_item(s); auto name = read_item(s); auto group = read_item(s); auto url = read_item(s); for (int i = 0; i < 3; ++i) skip_item(s); auto username = read_item(s); auto password = read_item(s); return {std::move(id), decrypt_aes256(name, encryption_key), decrypt_aes256(username, encryption_key), decrypt_aes256(password, encryption_key), decode_hex(url), decrypt_aes256(group, encryption_key)}; }
uint32_t decrypt_with_mode(const BYTE *password, const BYTE* data, uint32_t len, BYTE* ans, encrypt_mode mode, encrypt_method method) { uint32_t outl; switch (mode) { case AES128: outl = decrypt_aes128(password, data, len, ans, method); break; case AES192: outl = decrypt_aes192(password, data, len, ans, method); break; case AES256: outl = decrypt_aes256(password, data, len, ans, method); break; case DES: outl = decrypt_des(password, data, len, ans, method); break; } return outl; }