private void FillStringsWithoutSensitiveData(PassItem passItem) { foreach (var str in _kpPassItem.Strings.Where(a => a.Key != PASSWORD && !a.Value.IsProtected)) { passItem.Strings.TryAdd(str.Key, str.Value.ReadString()); } }
public void RestoreCopy(PassItem backup) { this.Id = backup.Id; this.UUID = backup.UUID; this.Tags = backup.Tags; this.Strings = backup.Strings.GetCopy(); this.Pass = backup.Pass; }
internal PassItem ConvertToPSD() { PassItem passItem = new PassItem(); passItem.UUID = _kpPassItem.Uuid.ToHexString(); passItem.Tags = _kpPassItem.Tags.ToArray(); passItem.SetPassFromString(_kpPassItem.Strings.GetSafe(PASSWORD).ReadString()); FillStringsWithoutSensitiveData(passItem); return passItem; }
public void Copy(PassItem backup) { this.Id = backup.Id; this.Title = backup.Title; this.Login = backup.Login; this.EnterWithLogin = backup.EnterWithLogin; this.Pass = backup.Pass; this.Description = backup.Description; }
private void DivideAndAdd(PassItem pass) { var passPart1Bytes = new byte[MaxPassLength]; _rngCsp.GetBytes(passPart1Bytes); var realPassBytes = pass.GetBytes(); var passPart2Bytes = XORArrays(passPart1Bytes, realPassBytes); if (!CheckCorrect(passPart1Bytes, passPart2Bytes, realPassBytes)) throw new Exception("WTF? Xor worked funny.."); var part1Pass = pass.GetCopy(); part1Pass.Pass = passPart1Bytes; Part1List.Add(part1Pass.Id.Value, part1Pass); var part2Pass = pass.GetCopy(); part2Pass.Pass = passPart2Bytes; Part2List.Add(part2Pass.Id.Value, part2Pass); }
private static PassItem ParsePassItem(string[] strArgs) { var title = GetArgVal(strArgs, "--title"); var password = GetArgVal(strArgs, "--password"); if (title == null || password == null) return null; var passItem = new PassItem(title, Encoding.ASCII.GetBytes(password)); ushort parsedId; if (!ushort.TryParse(GetArgVal(strArgs, "--id"), out parsedId)) passItem.Id = null; else passItem.Id = parsedId; passItem.Login = GetArgVal(strArgs, "--login"); passItem.EnterWithLogin = strArgs.Contains("--enter-with-login"); passItem.Description = GetArgVal(strArgs, "--description"); return passItem; }