Exemple #1
0
 public byte[] Decrypt(byte[] privateKey, byte[] ciphertext)
 {
     try
     {
         IPreService proxy = CreateProxy();
         return(proxy.Decrypt(privateKey, ciphertext));
     }
     catch (Exception e)
     {
         Logger.LogError("Error decrypting", e);
         throw;
     }
 }
Exemple #2
0
        private void BuildUserTree(TreeNode rootNode, IEnumerable <RoleDescription> roles)
        {
            foreach (RoleDescription role in roles)
            {
                IPreService preProxy = GetPreProxy();
                role.Name = preProxy.Decrypt(this.keyPair.Private, role.Name);
                TreeNode node = new TreeNode(role.Name.GetString(), 0, 0);

                node.Tag = role;
                rootNode.Nodes.Add(node);

                BuildUserTree(node, role.ChildRoles);

                foreach (UserDescription user in role.Users)
                {
                    preProxy  = GetPreProxy();
                    user.Name = preProxy.Decrypt(this.keyPair.Private, user.Name);
                    TreeNode userNode = new TreeNode(user.Name.GetString(), 1, 1);
                    userNode.Tag = user;
                    node.Nodes.Add(userNode);
                }
            }
        }
Exemple #3
0
        private bool RefreshRoles(RolesUserControl uc)
        {
            try
            {
                IGatewayService        proxy = CreateServiceProxy();
                IList <RoleClientInfo> roles = proxy.GetMyImmediateRoles(this.myId);

                foreach (RoleClientInfo role in roles)
                {
                    IPreService preService = CreatePreProxy();
                    role.Name = preService.Decrypt(this.keyPair.Private, role.Name);
                }

                uc.InsertRoles(roles);
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message);
                Logger.LogError("Error refreshing roles", ex);
            }
            return(false);
        }