Ejemplo n.º 1
0
		private void PrepareProtectSimpleResponse(string profileLocation)
		{
			InitializeEngine();

			AddProtectSimpleProfile(profileLocation);	// A profile is a policy, but we chose to call it a Profile :)

			if (m_encryptionManager == null)
			{
				m_encryptionManager = new ContentEncryptionManager(_msgExpander, _msgPacker);
			}

			if (m_encryptionUi != null)
			{
				m_encryptionUi.OnShowDialog += new ShowDialogEvent(m_encryptionUi_OnShowDialog);
			}

			if (!m_encryptionManager.DecryptRequestAttachments(m_request, m_encryptionUi))
			{
				if (!string.IsNullOrEmpty(m_encryptionManager.LastErrorText))
				{
					m_errors.Add(ErrorAsDialogTextKey + m_encryptionManager.LastErrorText);// prepend ErrorAsDialogTextKey constant so that we DO display the message to the user
					m_encryptionManager.LastErrorText = string.Empty;
					m_processResult = ProcessResult.ERRORS;
					m_bUpdateProcessResult = false;
				}
				else
				{
					m_processResult = ProcessResult.CANCELLED;
				}
				return;
			}

			m_response = CallContentScanner();
            
			ResponseAnalyser.CollectAndSendEvents(m_response, ResponseAnalyser.EventType.PolicySet);

			m_uiResponse = ResponseAdapter.UIResponseFromResponse(m_request, m_response);                      

			// hey, you know what - something might have gone wrong in that content scanning. Let's check
			object[] errors = m_uiResponse.GetErrors();
			if (errors.Length > 0)
			{
				// wow! something bad did happen. Better report it back to the user
				RecordDiscoveryErrors(errors);
				return;
			}

			string reason = string.Empty;
			if (!m_uiResponse.Synchronize(out reason))
			{
				Logger.LogError("Unable to synchronize responses. Reason = " + reason);
				m_processResult = ClientManager.ProcessResult.ERRORS;
				return;
			}

			// Check for violations
			if (m_uiResponse != null && !m_uiResponse.ContainsViolations())
			{
				m_processResult = ProcessResult.NO_VIOLATIONS;
				return;
			}

			// Check for Actions in uiResponse
			if (m_uiResponse != null && m_uiResponse.Actions.Count <= 0)
			{
				m_processResult = ProcessResult.NO_ACTIONS;
				return;
			}

			m_processResult = ProcessResult.UNDEFINED;

			CreateOfficeApplicationsUsingUroAttachments();

			return;
		}
Ejemplo n.º 2
0
		private bool ProcessPrematureResponse()
		{
			// Means scanning has not completed yet, and the user has pressed Send
			// We gonna scrap discovery stuff, and apply pre-set actions
			m_threadKiller.Abort();
			m_skipDiscovery = true;

            InitializeEngine();

			if (m_encryptionManager == null)
			{
				m_encryptionManager = new ContentEncryptionManager(_msgExpander, _msgPacker);
			}
			if (!m_encryptionManager.DecryptRequestAttachments(m_request, m_encryptionUi))
			{
				m_processResult = ProcessResult.CANCELLED;
				return false;
			}
			m_response = CallContentScanner();
			m_uiResponse = ResponseAdapter.UIResponseFromResponse(m_request, m_response);

			m_policyClientDialog.SetResponse(m_uiResponse);

			// Check for violations
			if (m_uiResponse != null && !m_uiResponse.ContainsViolations())
			{
				m_processResult = ProcessResult.NO_VIOLATIONS;
				return false;
			}

			// Check for Actions in uiResponse
			if (m_uiResponse != null && m_uiResponse.Actions.Count <= 0)
			{
				m_processResult = ProcessResult.NO_ACTIONS;
				return false;
			}

			m_processResult = ProcessResult.UNDEFINED;



			CreateOfficeApplicationsUsingUroAttachments();

			return true;
		}
Ejemplo n.º 3
0
		/// <summary>
		/// Constructor that take .msg unpacking delegates(and passes them to the encryption manager)
		/// </summary>
		/// <param name="request"></param>
		/// <param name="uiManager"></param>
		/// <param name="expandOutlookMessage"></param>
		/// <param name="packOutlookMessage"></param>
		public RequestManager(Request request, IPolicyClientUIManager2 uiManager, 
			ContentEncryptionManager.ExpandOutlookMessage expandOutlookMessage,
			ContentEncryptionManager.PackOutlookMessage packOutlookMessage)
		{
		    SendAndProtect = false;
		    m_request = request;
			m_uiManager = uiManager;
			m_processResult = ProcessResult.CANCELLED;
			IsLotusNotesMailClient = false;  
			_msgExpander = expandOutlookMessage;
			_msgPacker = packOutlookMessage;            
		}
Ejemplo n.º 4
0
        private void EngineWorker()
        {
			try
			{
				InitializeEngine();
				InitializePolicies();

				//if (IsInteractiveProtect)
				//    RemovePoliciesNotRequiredForInteractiveProtect();

				if (ShowProgress)
				{
					UpdatePolicyClientProgress(m_uiManager.ScanningForRiskText);
				}

				if (m_encryptionManager == null)
					m_encryptionManager = new ContentEncryptionManager(_msgExpander, _msgPacker);


				if (m_threadKiller != null)	// This function gets called from Tests' code and m_threadKiller is not initialized there.
				{
					m_threadKiller.ReadyToDie = false;
				}

				if (m_encryptionUi != null)
				{
					m_encryptionUi.OnShowDialog += new ShowDialogEvent(m_encryptionUi_OnShowDialog);
				}

				if (!m_encryptionManager.DecryptRequestAttachments(m_request, m_encryptionUi))
				{
					if (m_threadKiller != null)
					{
						m_threadKiller.ReadyToDie = true;
					}
					m_processResult = ProcessResult.CANCELLED;
					return;
				}

				if (m_threadKiller != null)
				{
					m_threadKiller.ReadyToDie = true;
				}
				EngineWorkerProcessResponse();
			}
			catch (Exception ex)
			{
				Logger.LogError(ex);
			}
            finally
            {
                if (m_threadKiller != null)
                {
                    m_threadKiller.ReadyToDie = false;
                }

                CreateOfficeApplicationsUsingUroAttachments();
                OnEngineWorkCompleted();

                if (m_threadKiller != null)
                {
                    m_threadKiller.ReadyToDie = true;
                }

                ResetPolicyCache();

                if (m_encryptionUi != null)
                {
                    m_encryptionUi.OnShowDialog -= new ShowDialogEvent(m_encryptionUi_OnShowDialog);
                }
            }        
        }
Ejemplo n.º 5
0
		public AttachmentEncryption()
		{
			_encryptionManager = new ContentEncryptionManager();
		}
Ejemplo n.º 6
0
        private static string DecryptFile(string filename)
        {
            using (var encryptionManager = new ContentEncryptionManager())
            {
                string decryptedFile;
                var result  = encryptionManager.DecryptFile(filename, Path.GetFileName(filename),
                    new InlineProtectContentEncryptionUI(new Form()
                    {
                        StartPosition = FormStartPosition.CenterScreen,
                        Visible = false
                    }), out decryptedFile);

                if (result != DecryptResult.Ok)
                    throw new InvalidCredentialException("");

                return decryptedFile;
            }
        }