/// <summary>
        /// Create a personal profile including the associated master and administration
        /// profiles.
        /// </summary>
        /// <param name="DeviceProfile">The device profile to be the initial 
        /// administration device for the profile.</param>

        public PersonalProfile(SignedDeviceProfile DeviceProfile) {
            _PersonalMasterProfile = new MasterProfile(CryptoCatalog.Default);
            SignedMasterProfile = new SignedMasterProfile(_PersonalMasterProfile);


            // Set up the device and application profiles.
            Initialize(_PersonalMasterProfile, DeviceProfile);
            }
        public void AddTest() {

            var Machine = RegistrationMachine.Current;

            var NewProfile = new SignedDeviceProfile("Test", "Test Device");
            var Registration = Machine.Add(NewProfile);

            }
        /// <summary>
        /// Create a new profile for [email protected]
        /// </summary>
        void CreateProfile() {
            // Create device profile
            SignedDeviceProfile1 = new SignedDeviceProfile(Device1, Device1Description);
            // Create master profile

            PersonalProfile = new PersonalProfile(SignedDeviceProfile1);
            SignedPersonalProfile = PersonalProfile.Signed;
            }
示例#4
0
        /// <summary>
        /// Create a new device profile
        /// </summary>
        /// <param name="Options">Command line parameters</param>
        public override void Device(Device Options) {
            var DeviceID = Utils.Default(Options.DeviceID.Value, "Default");
            var DeviceDescription = Utils.Default(Options.DeviceDescription.Value, "Unknown");

            var ProfileDevice = new SignedDeviceProfile(DeviceID, DeviceDescription);
            var RegistrationDevice = Machine.Add(ProfileDevice);

            if (Options.Default.Value) {
                Machine.Device = RegistrationDevice;
                }
            }
        /// <summary>
        /// Having read a tag, process the corresponding value data.
        /// </summary>
        /// <param name="JSONReader">The input stream</param>
        /// <param name="Tag">The tag</param>
		public override void DeserializeToken (JSONReader JSONReader, string Tag) {
			
			switch (Tag) {
				case "SignedMasterProfile" : {
					// An untagged structure
					SignedMasterProfile = new SignedMasterProfile (JSONReader);
 
					break;
					}
				case "Devices" : {
					// Have a sequence of values
					bool _Going = JSONReader.StartArray ();
					Devices = new List <SignedDeviceProfile> ();
					while (_Going) {
						// an untagged structure.
						var _Item = new SignedDeviceProfile (JSONReader);
						Devices.Add (_Item);
						_Going = JSONReader.NextArray ();
						}
					break;
					}
				case "Applications" : {
					// Have a sequence of values
					bool _Going = JSONReader.StartArray ();
					Applications = new List <ApplicationProfileEntry> ();
					while (_Going) {
						// an untagged structure.
						var _Item = new ApplicationProfileEntry (JSONReader);
						Applications.Add (_Item);
						_Going = JSONReader.NextArray ();
						}
					break;
					}
				default : {
					base.DeserializeToken(JSONReader, Tag);
					break;
					}
				}
			// check up that all the required elements are present
			}
        /// <summary>
        /// One time initialization of the page.
        /// </summary>
        public override void Initialize() {

            // Get the device profile or create a new one if necessary.
            ThisDevice = SignedDeviceProfile.GetLocal(Device1, Device1Description);



            if (DoLocal) {
                MeshPortal.Default = new MeshPortalDirect();

                // Get the default profile if possible
                MeshClient = new MeshClient(); // default account
                MeshClient.AccountID = AccountID;

                if (MeshClient.Connected) {
                    AccountName = MeshClient.AccountName;
                    Portal = MeshClient.Portal;
                    SignedCurrentProfile = SignedPersonalProfile.GetLocal(MeshClient.UDF);
                    Navigate(Data_SetupComplete);
                    }
                }


            else {

                JPCProvider.LocalLoopback = false;
                var Portal = new MeshPortalRemote();
                MeshPortal.Default = Portal;


                }


            }
        /// <summary>
        /// Add a second device
        /// </summary>
        void ConnectDevice() {
            
            // Create device profile
            SignedDeviceProfile2 = new SignedDeviceProfile(Device2, Device2Description);

            Portal.Label(LabelConnectRequest);
            // Post connection request
            MeshClient.ConnectRequest (SignedDeviceProfile2);

            Portal.Label(LabelConnectPending);
            // Poll for list of connection requests
            var ConnectPendingResult = MeshClient.ConnectPending();


            var FirstRequest = ConnectPendingResult.Pending[0];

            // Publish the updated profile to the Mesh.
            Portal.Label(LabelConnectPublish);
            PersonalProfile.Add(FirstRequest.Data.Device);
            SignedPersonalProfile = PersonalProfile.Signed;
            MeshClient.Publish(SignedPersonalProfile);

            Portal.Label(LabelConnectAccept);
            // Post acceptance for first request
            MeshClient.ConnectClose(FirstRequest, ConnectionStatus.Accepted);
            Portal.Label(LabelConnectStatus);
            // Retrieve acceptance
            MeshClient.ConnectStatus(SignedDeviceProfile2.UDF);
            }
 /// <summary>
 /// Create a new device profile and persist it in the registry
 /// as the default profile.
 /// </summary>
 /// <param name="Name">Name of the device</param>
 /// <param name="Description">Description of the device.</param>
 public SignedDeviceProfile(string Name, string Description) {
     var Data = new DeviceProfile(Name, Description);
     Sign(Data);
     _Current = this;
     }
        /// <summary>
        /// Initiate a device connection request.
        /// </summary>
        /// <param name="SignedDeviceProfile">The device profile to register.</param>
        /// <returns>The service response.</returns>
        public ConnectStartResponse ConnectRequest (SignedDeviceProfile SignedDeviceProfile) {
            this.SignedDeviceProfile = SignedDeviceProfile;

            var ConnectionRequest = new ConnectionRequest(AccountID, SignedDeviceProfile);

            var DeviceRequest = new ConnectStartRequest();
            DeviceRequest.SignedRequest = ConnectionRequest.Signed;
            DeviceRequest.AccountID = AccountID;
            var DeviceResponse = MeshService.ConnectStart(DeviceRequest);


            return DeviceResponse;
            }
        /// <summary>
        /// Add the specified device to the linked personal profile and 
        /// create any device specific entries in the private profile.
        /// </summary>
        /// <param name="Device">The device to add.</param>
        public virtual void AddDevice(SignedDeviceProfile Device) {
            // Create admin entry for this device

            ApplicationProfileEntry.AddDevice(Device);
            }
        public void CheckValid () {
            var DevProfile = new  SignedDeviceProfile(Device1, Device1Description);
            var UserProfile = new PersonalProfile(DevProfile);
            var PasswordProfile = new PasswordProfile(UserProfile);
            var SignedProfile = new SignedPersonalProfile(UserProfile);
            //PasswordProfile.AddDevice(DevProfile);

            Mesh.AddProfile(SignedProfile);

            var UserProfile2 = Mesh.GetPersonalProfile(UserName);
            }
        public void CheckInValidBadProfileSignature(Mesh Mesh) {
            var DevProfile = new SignedDeviceProfile(Device1, Device1Description);
            var UserProfile = new PersonalProfile(DevProfile);
            var PasswordProfile = new PasswordProfile(UserProfile);
            //PasswordProfile.AddDevice(DevProfile);

            var SignedProfile = new SignedPersonalProfile(UserProfile);

            Mesh.AddProfile(SignedProfile);
            
            var SignedProfile2 = Mesh.GetSignedPersonalProfile(UserName);
            Trace.Spoil(SignedProfile2.SignedData.Signature, SignedProfile2.SignedData.Signature);
            var FoundError = CheckProfileFails(SignedProfile2, typeof(System.Exception));

            Debug.Trace.Assert("Missed error", FoundError);
            }
        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;
            }
示例#14
0
		/// <summary>
        /// Construct an instance from the specified tagged JSONReader stream.
        /// </summary>
        /// <param name="JSONReader">Input stream</param>
        /// <param name="Out">The created object</param>
        public static void Deserialize(JSONReader JSONReader, out JSONObject Out) {
	
			JSONReader.StartObject ();
            if (JSONReader.EOR) {
                Out = null;
                return;
                }

			string token = JSONReader.ReadToken ();
			Out = null;

			switch (token) {

				case "PublicKey" : {
					var Result = new PublicKey ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "SignedData" : {
					var Result = new SignedData ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "EncryptedData" : {
					var Result = new EncryptedData ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "Connection" : {
					var Result = new Connection ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "Entry" : {
					var Result = new Entry ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "SignedProfile" : {
					var Result = new SignedProfile ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "Profile" : {
					Out = null;
					throw new Exception ("Can't create abstract type");
					}


				case "SignedDeviceProfile" : {
					var Result = new SignedDeviceProfile ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "DeviceProfile" : {
					var Result = new DeviceProfile ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "DevicePrivateProfile" : {
					var Result = new DevicePrivateProfile ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "SignedMasterProfile" : {
					var Result = new SignedMasterProfile ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "MasterProfile" : {
					var Result = new MasterProfile ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "SignedPersonalProfile" : {
					var Result = new SignedPersonalProfile ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "PersonalProfile" : {
					var Result = new PersonalProfile ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "SignedApplicationProfile" : {
					var Result = new SignedApplicationProfile ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "EncryptedProfile" : {
					var Result = new EncryptedProfile ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "ApplicationProfile" : {
					var Result = new ApplicationProfile ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "ApplicationProfilePrivate" : {
					var Result = new ApplicationProfilePrivate ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "ApplicationProfileEntry" : {
					var Result = new ApplicationProfileEntry ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "EscrowEntry" : {
					var Result = new EscrowEntry ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "OfflineEscrowEntry" : {
					var Result = new OfflineEscrowEntry ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "OnlineEscrowEntry" : {
					var Result = new OnlineEscrowEntry ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "EscrowedKeySet" : {
					var Result = new EscrowedKeySet ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "ConnectionRequest" : {
					var Result = new ConnectionRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "SignedConnectionRequest" : {
					var Result = new SignedConnectionRequest ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "ConnectionResult" : {
					var Result = new ConnectionResult ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "SignedConnectionResult" : {
					var Result = new SignedConnectionResult ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}

				default : {
					throw new Exception ("Not supported");
					}
				}	
			JSONReader.EndObject ();
            }
示例#15
0
        /// <summary>
        /// Having read a tag, process the corresponding value data.
        /// </summary>
        /// <param name="JSONReader">The input stream</param>
        /// <param name="Tag">The tag</param>
		public override void DeserializeToken (JSONReader JSONReader, string Tag) {
			
			switch (Tag) {
				case "ParentUDF" : {
					ParentUDF = JSONReader.ReadString ();
					break;
					}
				case "Device" : {
					// An untagged structure
					Device = new SignedDeviceProfile (JSONReader);
 
					break;
					}
				default : {
					break;
					}
				}
			// check up that all the required elements are present
			}
 /// <summary>
 /// Add a device to the profile.
 /// </summary>
 /// <param name="DeviceProfile">The device profile to add</param>
 public void Add(SignedDeviceProfile DeviceProfile) {
     Devices.Add(DeviceProfile);
     }
        /// <summary>
        /// Add the specified device to the linked personal profile and 
        /// create any device specific entries in the private profile.
        /// </summary>
        /// <param name="Device">The device to add.</param>
        public virtual void AddDevice(SignedDeviceProfile Device) {
            // Create admin entry for this device

            if (SignID == null) {
                SignID = new List<string>();
                }
            SignID.Add(Device.Identifier);

            if (DecryptID == null) {
                DecryptID = new List<string>();
                }
            DecryptID.Add(Device.Identifier);
            }
示例#18
0
        public void TestRegistry() {
            RegistrationMachine.Erase();

            var MeshAddress = "Testing@wherever";

            var Machine = RegistrationMachine.Current;
            var NewProfileDevice = new SignedDeviceProfile("Test", "Test Device");
            Machine.Add(NewProfileDevice);

            var PersonalProfile = new PersonalProfile(NewProfileDevice);
            var SignedPersonalProfile = PersonalProfile.Signed;

            Machine.Add(SignedPersonalProfile, MeshAddress);

            }
 /// <summary>
 /// Create a personal profile with the specified master and administration
 /// profiles.
 /// </summary>
 /// <param name="PersonalMasterProfile">The master profile for this 
 /// personal profile.</param>
 /// <param name="DeviceProfile">The device profile to be the initial 
 /// administration device for the profile.</param>
 public PersonalProfile(MasterProfile PersonalMasterProfile,
             SignedDeviceProfile DeviceProfile) {
     Initialize(PersonalMasterProfile, DeviceProfile);
     }
示例#20
0
        public void TestLiveMail () {

            // Create test Mesh
            File.Delete(Store);
            File.Delete(Portal);
            Mesh = new Mesh(Service, Store, Portal);

            // Create Master Profile

            Mesh.CheckAccount(AccountID);
            var DevProfile = new SignedDeviceProfile(Device1, Device1Description);
            var UserProfile = new PersonalProfile(DevProfile);

            var SignedProfile = UserProfile.Signed;
            Mesh.CreateAccount(UserName, SignedProfile);

            Mesh.GetAccount(UserName);


            // Read the LiveMail accounts

            var MailClientCatalog = new MailClientCatalogPlatform();
            MailClientCatalog.ImportWindowsLiveMail();
            MailClientCatalog.Dump();

            var MailAccount = MailClientCatalog.Accounts[0];
            // Add self signed certs if they don't have them already
            MailAccount.GenerateSMIME();

            // Write out the updated profile
            MailAccount.Update();

            //// Create Mail Profile
            //var MailProfile = new MailProfile(UserProfile, MailAccount);


            // Create Test Account from Mail Profile

            var NewMailInfo = new MailAccountInfoWLM();
            //MailProfile.Export(NewMailInfo);
            NewMailInfo.AccountName = "Test-Delete";

            // Write it out
            NewMailInfo.Create();

            }
示例#21
0
 void Report(SignedDeviceProfile Device) {
     Report("Profile {0}", Device.UDF);
     }
示例#22
0
        public void MeshStorem() {
            File.Delete(Store);
            File.Delete(Portal);
            Mesh = new Mesh(Service, Store, Portal);
            Mesh.CheckAccount(AccountID);

            var DevProfile = new SignedDeviceProfile(Device1, Device1Description);
            var UserProfile = new PersonalProfile(DevProfile);

            var SignedProfile = UserProfile.Signed;
            Mesh.CreateAccount(UserName, SignedProfile);

            Mesh.GetAccount(UserName);

            var PasswordProfile = new PasswordProfile(true);
            var SignedPasswordProfile = PasswordProfile.Signed;

            SignedProfile = UserProfile.Signed;
            Mesh.AddProfile(SignedPasswordProfile);
            Mesh.UpdateProfile(SignedProfile);





            }
示例#23
0
        /// <summary>
        /// Create a new personal profile
        /// </summary>
        /// <param name="Options">Command line parameters</param>
        public override void Personal(Personal Options) {
            SetReporting(Options.Report, Options.Verbose);

            var Address = Options.Portal.Value;
            Utils.Assert((Address != null & Address != ""), "Must specify account");


            // See if the portal exists and will accept the specified account name.
            GetMeshClient(Address);
            var AccountAvailable = MeshClient.Validate(AccountID);

            if (!AccountAvailable.Valid) {
                if (Options.Next.Value) {
                    GetNextAccount();
                    }
                else {
                    Utils.Error("Portal refused account {0} because {1}",
                        Address, AccountAvailable.Reason);
                    }
                }

            // Get / create the device profile if required
            RegistrationDevice RegistrationDevice = null;
            bool Generate = false;
            if (Options.DeviceNew.Value) {
                Generate = true;
                }
            else if (Options.DeviceUDF.Value != null) {
                // use the profile with the specified fingerprint
                var Found = Machine.GetUDF(Options.DeviceUDF.Value, out RegistrationDevice);
                Utils.Assert(Found, "Could not find profile " + Options.DeviceUDF.Value);
                }
            else if (Options.DeviceID.Value != null) {
                // use the profile with the specified ID
                var Found = Machine.GetID(Options.DeviceID.Value, out RegistrationDevice);
                Utils.Assert(Found, "Could not find profile " + Options.DeviceID.Value);
                }
            else if (Machine.Device != null) {
                RegistrationDevice = Machine.Device;
                }
            else {
                Generate = true;
                }

            // Generate a new device profile
            if (Generate) {
                var DeviceID = Utils.Default(Options.DeviceID.Value, "Default");
                var DeviceDescription = Utils.Default(Options.DeviceDescription.Value, "Unknown");

                var NewProfileDevice = new SignedDeviceProfile(DeviceID, DeviceDescription);
                RegistrationDevice = Machine.Add(NewProfileDevice);
                }
            var ProfileDevice = RegistrationDevice.Device;

            var PersonalProfile = new PersonalProfile(ProfileDevice);
            var SignedPersonalProfile = PersonalProfile.Signed;

            // add to the machine registry
            Machine.Add(SignedPersonalProfile, PortalID);

            // Register with the Mesh portal
            var PublishResult = MeshClient.Publish(SignedPersonalProfile);
            Utils.Assert(PublishResult.Status.StatusSuccess(), "Portal refused profile publication request");



            Report("Created new personal profile {0}", SignedPersonalProfile.UDF);
            Report("Device profile is {0}", ProfileDevice.UDF);
            Report("Profile registered to {0}", PortalID);

            }
示例#24
0
        public void MeshStore () {

            File.Delete(Store);
            File.Delete(Portal);
            Mesh = new Mesh(Service, Store, Portal);

            Mesh.CheckAccount(AccountID);

            var DevProfile = new SignedDeviceProfile(Device1, Device1Description);
            var UserProfile = new PersonalProfile(DevProfile);

            var SignedProfile = UserProfile.Signed;
            Mesh.CreateAccount(AccountID, SignedProfile);

            // Add the device to the profile entry in the parent.

            var PasswordProfile = new PasswordProfile(true);

            var SignedPasswordProfile = PasswordProfile.Signed;

            SignedProfile = UserProfile.Signed;
            Mesh.AddProfile(SignedPasswordProfile); 
            Mesh.UpdateProfile(SignedProfile);

            // ok now pull the profile as a client.

            var Account = Mesh.GetAccount(AccountID); 
            var AccountPersonalProfile = Mesh.GetPersonalProfile(Account.UserProfileUDF);
            AccountPersonalProfile.SignedDeviceProfile = DevProfile;

            var PasswordEntry = AccountPersonalProfile.GetPasswordProfile();
            var SignedPasswordProfile2 = 
                Mesh.GetProfile(PasswordEntry.Identifier) as SignedProfile;

            var AccountPasswordProfile = PasswordProfile.Get(
                            SignedPasswordProfile2, AccountPersonalProfile);
            AccountPasswordProfile.Add(PWDSite, PWDUser, PWDPassword);

            // Implement the second way to do things, cleaner.
            //var AccountSignedPassword = new SignedPasswordProfile(AccountPasswordProfile);
            var AccountSignedPassword = AccountPasswordProfile.Signed;
            Mesh.UpdateProfile(AccountSignedPassword);

            // Now add a new device

            var DevProfile2 = new SignedDeviceProfile(Device2, Device2Description);

            // Post Connect Request
            Mesh.GetChainToken();
            var ConnectionRequest = new ConnectionRequest(Account, DevProfile2);

            Mesh.PostConnectionRequest(ConnectionRequest.Signed, 
                Account.UniqueID);

            // Get list of pending requests
            Mesh.GetPendingRequests(Account.AccountID);

            // Accept pending request


            var ConnectionResult = new ConnectionResult();
            ConnectionResult.Result = "Accept";
            ConnectionResult.Device = DevProfile2;
            var SignedConnectionResult = new SignedConnectionResult(ConnectionResult,
                AccountPersonalProfile.GetAdministrationKey());
            Mesh.CloseConnectionRequest(Account.AccountID, SignedConnectionResult);


            // Pull password data 
            Mesh.GetRequestStatus(Account.AccountID, DevProfile2.UDF);


            // decrypt using device2 credential
            var SignedPasswordProfile3 = 
                Mesh.GetProfile(PasswordEntry.Identifier) as SignedProfile;
            var PP3 = PasswordProfile.Get(SignedPasswordProfile3, AccountPersonalProfile);
            var PasswordPrivate = PP3.Private;


            }
        /// <summary>
        /// Initialize the class, called once when dialog is created.
        /// </summary>
        public override void Initialize() {

            if (DoLocal) {
                MeshPortal.Default = new MeshPortalDirect();
                }

            else {
                JPCProvider.LocalLoopback = false;
                var Portal = new MeshPortalRemote();
                MeshPortal.Default = Portal;
                }


            //DevProfile = SignedDeviceProfile.GetLocal(Pending);

            if (DevProfile == null) {
                DevProfile = new SignedDeviceProfile(Device1, Device1Description);
                DevProfile.ToRegistry(Pending);
                }

            }
        /// <summary>
        /// Construct a connection request to attach a device to the 
        /// personal profile of the specified account.
        /// </summary>
        /// <param name="Account">Account to request connection to.</param>
        /// <param name="Device">Device to connect.</param>
        public ConnectionRequest (Account Account, SignedDeviceProfile Device) {

            ParentUDF = Account.UserProfileUDF;
            this.Device = Device;


            }
        /// <summary>
        /// Construct a connection request to attach a device to the 
        /// personal profile of the specified account.
        /// </summary>
        /// <param name="AccountID">Account to request connection to.</param>
        /// <param name="Device">Device to connect.</param>
        public ConnectionRequest(string AccountID, SignedDeviceProfile Device) {

            ParentUDF = AccountID;
            this.Device = Device;


            }
        private void Initialize (MasterProfile PersonalMasterProfile,
                    SignedDeviceProfile DeviceProfile) {
            SignedDeviceProfile = DeviceProfile;

            Identifier = _PersonalMasterProfile.MasterSignatureKey.UDF;
            Devices = new List<SignedDeviceProfile>();
            Devices.Add(DeviceProfile);
            Applications = new List<ApplicationProfileEntry>();
            }
示例#29
0
        /// <summary>
        /// Add a device to an application profile 
        /// </summary>
        /// <param name="Entry">Applicationprofile entry to update</param>
        /// <param name="PersonalProfile">Personal profile to link to</param>
        /// <param name="Device">Signed device profile.</param>
        public void AddDevice(ApplicationProfileEntry Entry, 
                    PersonalProfile PersonalProfile,
                SignedDeviceProfile Device) {

            // Add an entry into the application profile
            // This is not required for profile maintenance but 
            // is needed for navigation (it seems.
            //Entry.ApplicationProfile.AddDevice(Device);

            // Add entries into the application profile entry
            // This sets up the permissions.

            Entry.AddDevice(Device);

            var SignedAppProfile = MeshClient.GetApplicationProfile(Entry.Identifier);
            if (SignedAppProfile == null) return;

            var AppProfile = SignedAppProfile.Signed;
            AppProfile.Link(PersonalProfile);
            AppProfile.EncryptPrivate();
            var NewSignedAppProfile = new SignedApplicationProfile(AppProfile);
            MeshClient.Publish(NewSignedAppProfile);
            }
示例#30
0
        /// <summary>
        /// Deserialize a tagged stream
        /// </summary>
        /// <param name="JSONReader">The input stream</param>
        /// <returns>The created object.</returns>		
        public static new SignedDeviceProfile  FromTagged (JSONReader JSONReader) {
			SignedDeviceProfile Out = null;

			JSONReader.StartObject ();
            if (JSONReader.EOR) {
                return null;
                }

			string token = JSONReader.ReadToken ();

			switch (token) {

				case "SignedDeviceProfile" : {
					var Result = new SignedDeviceProfile ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}

				default : {
					//Ignore the unknown data
                    //throw new Exception ("Not supported");
                    break;
					}
				}
			JSONReader.EndObject ();

			return Out;
			}