static void CreateNewList() { if (File.Exists(GetAbsolutePath("list"))) { if (!PromptConfirm("You already have a keylist. Overwrite?")) { return; } } string password = DiscreetPrompt("Enter password"); byte[] salt = CryptoBox.GetRandomBytes(16); File.WriteAllBytes(GetAbsolutePath("salt"), salt); Console.Write("Generating key..."); byte[] key = CryptoBox.GenerateKeyFromPassword(password, salt, CryptoBox.DefaultKeySize); Key = key; Console.WriteLine("done."); PasswordList list = new PasswordList(); CryptoBox.SafeSerialize(list, key, GetAbsolutePath("list")); List = list; Console.WriteLine("Created new encrypted keylist."); AfterUnlock(); }
static void Save() { CryptoBox.SafeSerialize(List, Key, GetAbsolutePath("list")); }