/// Create a new web application profile. /// </summary> /// <param name="Options">Command line parameters</param> public override void Password(Password Options) { SetReporting(Options.Report, Options.Verbose); GetProfile(Options.Portal, Options.UDF); GetMeshClient(); var DeviceProfile = GetDevice(SignedPersonalProfile); Utils.Assert(DeviceProfile, "Could not locate a device profile on this device"); var PersonalProfile = SignedPersonalProfile.Signed; var PasswordProfile = new PasswordProfile(true); var ApplicationProfileEntry = PersonalProfile.Add(PasswordProfile); ApplicationProfileEntry.AddDevice(DeviceProfile); PasswordProfile.Link(PersonalProfile, ApplicationProfileEntry); var SignedPasswordProfile = PasswordProfile.Signed; Machine.Add(SignedPasswordProfile); RegistrationPersonal.Update(); MeshClient.Publish(SignedPasswordProfile); MeshClient.Publish(RegistrationPersonal.Profile); }
/// <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); }
/// <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(); }
private void GetPasswordProfile () { PasswordEntry = SignedPersonalProfile.Signed.GetApplicationEntryPassword( null); PasswordRegistration = Machine.Get(PasswordEntry); SignedApplicationWeb = PasswordRegistration.Profile; PasswordProfile = SignedApplicationWeb.Signed as PasswordProfile; PasswordProfile.Link (SignedPersonalProfile.Signed, PasswordEntry); PasswordProfilePrivate = PasswordProfile.Private; return; }
/// <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 "PasswordProfile" : { var Result = new PasswordProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "PasswordProfilePrivate" : { var Result = new PasswordProfilePrivate (); Result.Deserialize (JSONReader); Out = Result; break; } case "PasswordEntry" : { var Result = new PasswordEntry (); Result.Deserialize (JSONReader); Out = Result; break; } default : { throw new Exception ("Not supported"); } } JSONReader.EndObject (); }
/// <summary> /// Deserialize a tagged stream /// </summary> /// <param name="JSONReader">The input stream</param> /// <returns>The created object.</returns> public static new PasswordProfile FromTagged (JSONReader JSONReader) { PasswordProfile Out = null; JSONReader.StartObject (); if (JSONReader.EOR) { return null; } string token = JSONReader.ReadToken (); switch (token) { case "PasswordProfile" : { var Result = new PasswordProfile (); Result.Deserialize (JSONReader); Out = Result; break; } default : { //Ignore the unknown data //throw new Exception ("Not supported"); break; } } JSONReader.EndObject (); return Out; }
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; }
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); }
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; }