Beispiel #1
0
 public bool Decode(OutboundConversionOptions options, bool acquireLicense)
 {
     this.CheckDisposed("Decode");
     Util.ThrowOnNullArgument(options, "options");
     this.decryptionStatus = RightsManagedMessageDecryptionStatus.Success;
     if (this.decodedItem != null)
     {
         return(true);
     }
     if (this.InternalSession == null)
     {
         this.decryptionStatus = RightsManagedMessageDecryptionStatus.NotSupported;
         throw new InvalidOperationException("Decoding of in-memory messages is not supported.");
     }
     RightsManagedMessageItem.CheckSession(this.InternalSession);
     this.SetConversionOptions(options);
     using (DisposeGuard disposeGuard = default(DisposeGuard))
     {
         try
         {
             MessageItem messageItem = ItemConversion.OpenRestrictedContent(this, this.orgId, acquireLicense, out this.licenseAcquired, out this.useLicenseValue, out this.restrictionInfo);
             if (messageItem == null)
             {
                 ExTraceGlobals.StorageTracer.TraceError(0L, "Failed to decode protected message - no user license is present.");
                 throw new RightsManagementPermanentException(RightsManagementFailureCode.UnknownFailure, ServerStrings.GenericFailureRMDecryption);
             }
             disposeGuard.Add <MessageItem>(messageItem);
             this.UpdateEffectiveRights();
             this.conversationOwner = new Participant(this.restrictionInfo.ConversationOwner, this.restrictionInfo.ConversationOwner, "SMTP");
             this.CheckPermission(ContentRight.View);
             messageItem.CoreItem.TopLevelItem = (base.CoreItem.TopLevelItem ?? base.CoreItem);
             this.serverUseLicense             = (messageItem.TryGetProperty(MessageItemSchema.DRMServerLicense) as string);
             this.publishLicense = (messageItem.TryGetProperty(MessageItemSchema.DrmPublishLicense) as string);
             this.rmsTemplate    = RmsTemplate.CreateFromPublishLicense(this.publishLicense);
             MsgToRpMsgConverter.CallRM(delegate
             {
                 this.publishedByExternalRMS = !RmsClientManager.IsPublishedByOrganizationRMS(this.orgId, this.publishLicense);
             }, ServerStrings.FailedToCheckPublishLicenseOwnership(this.orgId.ToString()));
             this.decodedItem = messageItem;
             disposeGuard.Success();
         }
         catch (RightsManagementPermanentException exception)
         {
             this.decryptionStatus = RightsManagedMessageDecryptionStatus.CreateFromException(exception);
             throw;
         }
         catch (RightsManagementTransientException exception2)
         {
             this.decryptionStatus = RightsManagedMessageDecryptionStatus.CreateFromException(exception2);
             throw;
         }
     }
     return(true);
 }
Beispiel #2
0
 internal static ItemPartIrmInfo CreateForDecryptionFailure(Exception exception)
 {
     return(new ItemPartIrmInfo(true, ContentRight.None, string.Empty, string.Empty, string.Empty, RightsManagedMessageDecryptionStatus.CreateFromException(exception), ExDateTime.MinValue, true, false));
 }
Beispiel #3
0
 private ItemPartIrmInfo(bool isRestricted, ContentRight usageRights, string templateName, string templateDescription, string conversationOwner, RightsManagedMessageDecryptionStatus decryptionStatus, ExDateTime userLicenseExpiryTime, bool requiresRepublishingWhenRecipientsChange, bool canRepublish)
 {
     this.isRestricted          = isRestricted;
     this.usageRights           = usageRights;
     this.templateName          = templateName;
     this.templateDescription   = templateDescription;
     this.conversationOwner     = conversationOwner;
     this.decryptionStatus      = decryptionStatus;
     this.userLicenseExpiryTime = userLicenseExpiryTime;
     this.requiresRepublishingWhenRecipientsChange = requiresRepublishingWhenRecipientsChange;
     this.canRepublish = canRepublish;
 }