private void AddKey(PwDatabase database, PwGroup group, Key key) { var entry = new PwEntry(true, true); group.AddEntry(entry, true); entry.Strings.Set(PwDefs.TitleField, new ProtectedString(database.MemoryProtection.ProtectTitle, key.Type)); entry.Strings.Set(PwDefs.PasswordField, new ProtectedString(database.MemoryProtection.ProtectPassword, key.Value)); entry.Strings.Set(PwDefs.NotesField, new ProtectedString(database.MemoryProtection.ProtectNotes, key.Description)); }
private bool GroupContainsKeyAsPassword(PwGroup group, Key key) { foreach (var entry in group.Entries) { if (key.Value == entry.Strings.Get(PwDefs.PasswordField).ReadString()) return true; } return false; }