예제 #1
0
        private KeePassLib.Cryptography.PasswordGenerator.PwProfile GetIotaProfile()
        {
            var charSet = new KeePassLib.Cryptography.PasswordGenerator.PwCharSet("ABCDEFGHIJKLMNOPQRST9");
            var profile = new KeePassLib.Cryptography.PasswordGenerator.PwProfile()
            {
                CharSet = charSet
            };

            profile.Length = 81;
            return(profile);
        }
예제 #2
0
        private static KeePassLib.Cryptography.PasswordGenerator.PwProfile ReadPwProfile(XmlReader xr)
        {
            KeePassLib.Cryptography.PasswordGenerator.PwProfile o = new KeePassLib.Cryptography.PasswordGenerator.PwProfile();

            if(SkipEmptyElement(xr)) return o;

            Debug.Assert(xr.NodeType == XmlNodeType.Element);
            xr.ReadStartElement();
            xr.MoveToContent();

            while(true)
            {
                XmlNodeType nt = xr.NodeType;
                if((nt == XmlNodeType.EndElement) || (nt == XmlNodeType.None)) break;
                if(nt != XmlNodeType.Element) { Debug.Assert(false); continue; }

                switch(xr.LocalName)
                {
                    case "Name":
                        o.Name = ReadString(xr);
                        break;
                    case "GeneratorType":
                        o.GeneratorType = ReadPasswordGeneratorType(xr);
                        break;
                    case "CollectUserEntropy":
                        o.CollectUserEntropy = ReadBoolean(xr);
                        break;
                    case "Length":
                        o.Length = ReadUInt32(xr);
                        break;
                    case "CharSetRanges":
                        o.CharSetRanges = ReadString(xr);
                        break;
                    case "CharSetAdditional":
                        o.CharSetAdditional = ReadString(xr);
                        break;
                    case "Pattern":
                        o.Pattern = ReadString(xr);
                        break;
                    case "PatternPermutePassword":
                        o.PatternPermutePassword = ReadBoolean(xr);
                        break;
                    case "ExcludeLookAlike":
                        o.ExcludeLookAlike = ReadBoolean(xr);
                        break;
                    case "NoRepeatingCharacters":
                        o.NoRepeatingCharacters = ReadBoolean(xr);
                        break;
                    case "ExcludeCharacters":
                        o.ExcludeCharacters = ReadString(xr);
                        break;
                    case "CustomAlgorithmUuid":
                        o.CustomAlgorithmUuid = ReadString(xr);
                        break;
                    case "CustomAlgorithmOptions":
                        o.CustomAlgorithmOptions = ReadString(xr);
                        break;
                    default:
                        Debug.Assert(false);
                        xr.Skip();
                        break;
                }

                xr.MoveToContent();
            }

            Debug.Assert(xr.NodeType == XmlNodeType.EndElement);
            xr.ReadEndElement();
            return o;
        }