The Mathamatical Mesh persistence store.
Пример #1
0
 /// <summary>
 /// Initialize a Mesh Service Provider.
 /// </summary>
 /// <param name="Domain">The domain of the service provider.</param>
 /// <param name="MeshStore">The mesh persistence store filename.</param>
 /// <param name="PortalStore">The portal persistence store fielname.</param>
 public PublicMeshServiceProvider(string Domain, string MeshStore, string PortalStore) {
     _Mesh = new Mesh(Domain, MeshStore, PortalStore);
     }
Пример #2
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;


            }
Пример #3
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);





            }
Пример #4
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();

            }
 public static void InitializeClass(TestContext context) {
     Mesh = new Mesh(Service);  // connect to the mesh
     }
        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);
            }