/// <summary> /// Shows standard decryption error UI within the context of a parent form /// </summary> public static DecryptionErrorAction OnDecryptionError(Control form, IContentEncryption encryptor) { if (form.InvokeRequired) { DecryptionErrorAction result = DecryptionErrorAction.Skip; IAsyncResult async = form.BeginInvoke(new MethodInvoker(delegate { result = ShowDecryptionErrorDialog(form, encryptor); })); form.EndInvoke(async); return result; } return ShowDecryptionErrorDialog(form, encryptor); }
/// <summary> /// Shows standard incorrect password UI within the context of a parent form /// </summary> public static DecryptionErrorAction OnIncorrectPassword(Control form, IContentEncryption encryptor) { return DecryptionErrorAction.Retry; }
/// <summary> /// Shows standard incorrect password dialog /// </summary> public static DecryptionErrorAction ShowIncorrectPasswordDialog(IWin32Window form, IContentEncryption encryptor) { IncorrectPasswordDialog dlg = new IncorrectPasswordDialog(encryptor.Name); return dlg.ShowDialog(form); }
/// <summary> /// Called if the password provided by the UI was incorrect /// </summary> public DecryptionErrorAction OnIncorrectPassword(IContentEncryption encryptor) { return m_IncorrectPasswordAction; }
/// <summary> /// Shows standard decryption error dialog /// </summary> public static DecryptionErrorAction ShowDecryptionErrorDialog(IWin32Window form, IContentEncryption encryptor) { DecryptionErrorDialog dlg = new DecryptionErrorDialog(encryptor.Name); return dlg.ShowDialog(form); }
public DecryptionErrorAction OnDecryptionError(IContentEncryption encryptor) { return DefaultFormContentEncryptionUi.OnDecryptionError(this, encryptor); }
public DecryptionErrorAction OnIncorrectPassword(IContentEncryption encryptor) { return DefaultFormContentEncryptionUi.OnIncorrectPassword(this, encryptor); }
private void AddEncryptionProperty(ref Attachment attachment, IContentEncryption encryption) { if (encryption != null && attachment != null && attachment.Properties != null) { List<CustomProperty> lcp = new List<CustomProperty>(attachment.Properties); bool bEncryption = (encryption.RequiresDecryption || encryption.RequiresModifyPassword || encryption.RequiresOpenPassword); lcp.Add(new CustomProperty("AttachmentWasEncrypted", bEncryption.ToString(CultureInfo.InvariantCulture))); if (!String.IsNullOrEmpty(encryption.OpenPassword)) { var password = encryption.OpenPassword; attachment.File.Password = password; lcp.Add(new CustomProperty("OpenPassword", password)); } attachment.Properties = lcp.ToArray(); } }
private void AssociateEncryptorWithData(string dataName, IContentEncryption encryptor) { if (encryptor != null) { // Remove any existing entry, so that we can handle the scenario of the user cancelling/changing password/resending if (_encryptionMap.ContainsKey(dataName)) { _encryptionMap.Remove(dataName); } _encryptionMap.Add(dataName, encryptor); } }
/// <summary> /// Creates a default encryption object given the object type /// </summary> private IContentEncryption CreateEncryptionObject(Attachment attachment, IContentEncryption defaultEncryptor) { IContentEncryption result = null; // Create an encryption object and associate it with the attachment's name Workshare.FCS.Lite.Interface.File file = new Workshare.FCS.Lite.Interface.File(attachment.File.FileName, attachment.File.DisplayName); switch (file.FileType) { case FileType.ZIP: result = new ZipEncryption(attachment, file); break; case FileType.WordDocument: case FileType.WordDocumentX: case FileType.WordDocumentMacroX: case FileType.WordDocumentTemplateX: case FileType.WordDocumentMacroTemplateX: case FileType.RTFDocument: result = new WordEncryption(attachment, file); break; case FileType.ExcelSheet: case FileType.ExcelSheetX: case FileType.ExcelSheetMacroX: case FileType.ExcelSheetTemplateX: case FileType.ExcelSheetMacroTemplateX: result = new ExcelEncryption(attachment, file); break; case FileType.PowerPoint: case FileType.PowerPointX: case FileType.PowerPointMacroX: case FileType.PowerPointTemplateX: case FileType.PowerPointMacroTemplateX: case FileType.PowerPointShowX: case FileType.PowerPointMacroShowX: if (!OfficeApplicationVersion.IsPowerPointXP()) { result = new PowerPointEncryption(attachment, file); } break; case FileType.PDFDocument: result = new PDFEncryption(attachment, file); break; } // See GetAssociatedEncryptionObject. // If teh file type has been changed by an action (e.g. PDF) then we recreate the encryption // object and copy over the old password fields. However, if we are zipping up the documents // then we aren't changing their file type and should not enrypt the container. if( defaultEncryptor != null && file.FileType != FileType.ZIP ) { // Copy across the passwords to the new encryption object result.ModifyPassword = defaultEncryptor.ModifyPassword; result.OpenPassword = defaultEncryptor.OpenPassword; result.AllowDefaultPassword = defaultEncryptor.AllowDefaultPassword; result.WasReadOnly = defaultEncryptor.WasReadOnly; } return result; }
public DecryptionErrorAction OnDecryptionError(IContentEncryption encryptor) { return DecryptionErrorAction.Skip; }
//инициализация public PostsController(CustomContentManager contentManager , IContentEncryption contentEncryption) : base(contentManager) { _contentEncryption = contentEncryption; }