/// <summary>
        /// Create a Web credential profile.
        /// </summary>
        void AddApplicationWeb() {

            // Create basic application
            PasswordProfile = new PasswordProfile(true);
            var ApplicationProfileEntry = PersonalProfile.Add(PasswordProfile);
            PasswordProfile.Link(PersonalProfile, ApplicationProfileEntry);

            // Add decryption blobs for each device granted access
            PasswordProfile.AddDevice(SignedDeviceProfile1);
            PasswordProfile.AddDevice(SignedDeviceProfile2);

            Portal.Label(LabelApplicationPublish);
            // Publish the application profile to the Mesh
            MeshClient.Publish(PasswordProfile.Signed);

            Portal.Label(LabelApplicationProfile);
            // Publish the user profile to the Mesh
            //PersonalProfile.Add(SignedPasswordProfile);
            MeshClient.Publish(SignedPersonalProfile);


            PasswordProfile.Add("example.com", "alice", "secret");
            PasswordProfile.Add("cnn.com", "alice1", "secret");

            PasswordProfilePrivate1 = PasswordProfile.Private.ToString();
            PasswordProfile.Private.AutoGenerate = true;

            PasswordProfilePrivate2 = PasswordProfile.Private.ToString();

            PasswordProfile.Private.NeverAsk = new List<string> { "bank.com" };

            PasswordProfilePrivate3 = PasswordProfile.Private.ToString();
            }
        /// <summary>
        /// Generate a new profile with the requested options. Note that this could be
        /// parallelized very easily by performing time consuming operations (e.g. generating
        /// keys) while the user is answering other questions.
        /// </summary>
        public void GenerateProfile() {

            UserProfile = new PersonalProfile(ThisDevice);
            UDF = UserProfile.PersonalMasterProfile.MasterSignatureKey.UDF;

            if (ConfigurePassword) {
                var PasswordProfile = new PasswordProfile(UserProfile);
                PasswordProfile.AddDevice(ThisDevice);
                MeshClient.Publish(PasswordProfile.Signed);
                }

            if (ConfigureNetwork) {
                var NetworkProfile = new NetworkProfile(UserProfile);
                NetworkProfile.AddDevice(ThisDevice);
                MeshClient.Publish(NetworkProfile.Signed);
                }

            if (ConfigureEmail) {
                foreach (var MailAccountInfo in MailAccountInfos) {
                    // Add in the S/MIME parameters and update the profile
                    //if (!MailAccountInfo.GotSMIME) {
                        MailAccountInfo.GenerateSMIME();
                        MailAccountInfo.Update();
                        //}

                    var MailProfile = new MailProfile(UserProfile, MailAccountInfo);
                    MailProfile.AddDevice(ThisDevice);

                    //var SignedMailProfile = new SignedApplicationProfile(MailProfile);
                    MeshClient.Publish(MailProfile.Signed);
                    }
                }

            if (ConfigureRecovery) {
                MakeCheckRecovery();
                }

            // publish to the cloud
            var SignedProfile = new SignedPersonalProfile(UserProfile);
            SignedProfile.ToRegistry();

            MeshClient.CreatePersonalProfile(AccountID, SignedProfile);
            }
        public bool Calculate() {

            if (NewDeviceProfile) {
                var NewProfile = new SignedDeviceProfile(DeviceName, DeviceDescription);
                _DeviceProfile = NewProfile;
                }
            else {
                _DeviceProfile = ProfileManager.RegistrationMachine.Device.Device;
                }
            _PersonalProfile = new PersonalProfile(_DeviceProfile);


            // Have got the profile, escrow the key
            if (EscrowKeys) {
                var OfflineEscrowEntry = new
                    OfflineEscrowEntry(_PersonalProfile, EscrowShares, EscrowQuorum);

                EscrowKeyShares = new List<Goedel.Trojan.Object>();

                int Index = 1;
                foreach (var KeyShare in OfflineEscrowEntry.KeyShares) {
                    var Share = new Share();
                    Share.Number.Value = Index++;
                    Share.Value.Value = KeyShare.Text;
                    EscrowKeyShares.Add(Share);
                    }
                }

            if (WebApplicationProfile) {
                PasswordProfile = new PasswordProfile(PersonalProfile);
                PasswordProfile.AddDevice(_DeviceProfile);
                }

            // Mail profiles here
            /*
                             foreach (var MailAccountInfo in MailAccountInfos) {
                                // Add in the S/MIME parameters and update the profile
                                //if (!MailAccountInfo.GotSMIME) {
                                    MailAccountInfo.GenerateSMIME();
                                    MailAccountInfo.Update();
                                    //}

                                var MailProfile = new MailProfile(UserProfile, MailAccountInfo);
                                MailProfile.AddDevice(ThisDevice);

                                //var SignedMailProfile = new SignedApplicationProfile(MailProfile);
                                MeshClient.Publish(MailProfile.Signed);
                                }
             * */

            // Network profiles here
            /*
                                var NetworkProfile = new NetworkProfile(UserProfile);
                                NetworkProfile.AddDevice(ThisDevice);
                                MeshClient.Publish(NetworkProfile.Signed);
            */

            // SSH profiles here


            SignedPasswordProfile = PasswordProfile.Signed;
            _SignedPersonalProfile = new SignedPersonalProfile(PersonalProfile);

            return true;
            }