/// <summary>
 /// Initializes a new instance of the <see cref="LoginViewModel"/> class.
 /// </summary>
 /// <param name="thisWindow">Window in which LoginControl is shown.</param>
 public LoginViewModel(ViewModelHistory thisWindow)
 {
     this.thisWindow         = thisWindow;
     this.Username           = "******";
     this.PrivateKeyFilePath = "OPENSSL\\private\\default.key";
     this.UserDatabasePath   = "root\\Users.db";
     this.AreActionsEnabled  = true;
     try
     {
         using (FileStream propertyFile = new FileStream("settings.cfg", FileMode.Open))
         {
             PropertiesStreams.Properties props = new PropertiesStreams.Properties();
             props.Load(propertyFile);
             this.UserDatabasePath = props.GetProperty("userdb", string.Empty);
         }
     }
     catch (Exception)
     {
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainViewModel"/> class.
        /// </summary>
        /// <param name="currentUser">All the required information about the current logged in user.</param>
        /// <param name="data">Instance of <see cref="DataComponents"/> that allows access to user database and certificates.</param>
        /// <param name="thisWindow">Window in which MainControl is shown.</param>
        public MainViewModel(UserInformation currentUser, UserDatabase data, ViewModelHistory thisWindow)
        {
            this.currentUserInfo = currentUser;
            this.thisWindow      = thisWindow;

            this.operationModes.Add("Encrypt");
            this.operationModes.Add("Decrypt");
            this.ChosenMode = this.operationModes[0];

            this.hashAlgorithms.Add(new HashAlgorithmChoice("SHA256", SHA256.Create()));
            this.hashAlgorithms.Add(new HashAlgorithmChoice("MD5", MD5.Create()));
            this.ChosenHashAlgorithm = this.hashAlgorithms[0];

            this.encryptionAlgorithms.Add(new EncryptionAlgorithmChoice("AES", new AesMachine()));
            this.encryptionAlgorithms.Add(new EncryptionAlgorithmChoice("TripleDES", new TDesMachine()));
            this.encryptionAlgorithms.Add(new EncryptionAlgorithmChoice("Twofish", new TwofishMachine()));
            this.ChosenEncryptionAlgorithm = this.encryptionAlgorithms[0];

            this.allUsers.AddRange(data.GetAllUsers().Where((user) => user.Username != currentUser.Username));
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OutputViewModel"/> class.
 /// </summary>
 /// <param name="thisWindow">Window in which LoginControl is shown.</param>
 /// <param name="backViewModel">UserControl to return to after completion.</param>
 public OutputViewModel(ViewModelHistory thisWindow)
 {
     this.thisWindow               = thisWindow;
     this.IsBackEnabled            = false;
     this.CurrentOperationProgress = 0;
 }
 public RegisterViewModel(ViewModelHistory thisWindow, UserDatabase data)
 {
     this.thisWindow = thisWindow;
     this.data       = data;
 }