Ejemplo n.º 1
0
 /// <summary>
 /// Creates a new instance of RightsManagementException class.
 /// This constructor initializes the Message property of the new instance to a system-supplied message 
 /// that describes the error. This message takes into account the current system culture.
 /// The FailureCode property is initialized using the failureCode parameter.
 /// </summary>
 /// <param name="failureCode">The FailureCode that indicates specific reason for the exception.</param>
 public RightsManagementException(RightsManagementFailureCode failureCode) : 
                                             base(Errors.GetLocalizedFailureCodeMessageWithDefault(failureCode))
 {
     _failureCode = failureCode; // we do not check the validity of the failureCode range , as it might contain a generic 
                                                  //  HR code, not covered by the RightsManagementFailureCode enumeration 
     
 }
Ejemplo n.º 2
0
 internal static string GetLocalizedFailureCodeMessageWithDefault(RightsManagementFailureCode failureCode)
 {
     string errorMessage = GetLocalizedFailureCodeMessage(failureCode);
     if (errorMessage != null)
     {
         return errorMessage;
     }
     else
     {
         return SR.Get(SRID.RmExceptionGenericMessage);
     }
 }
Ejemplo n.º 3
0
        internal static string GetLocalizedFailureCodeMessageWithDefault(RightsManagementFailureCode failureCode)
        {
            string errorMessage = GetLocalizedFailureCodeMessage(failureCode);

            if (errorMessage != null)
            {
                return(errorMessage);
            }
            else
            {
                return(SR.Get(SRID.RmExceptionGenericMessage));
            }
        }
Ejemplo n.º 4
0
 protected RightsManagementPermanentException(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     this.FailureCode = (RightsManagementFailureCode)info.GetValue("failureCode", typeof(RightsManagementFailureCode));
 }
Ejemplo n.º 5
0
 public RightsManagementPermanentException(LocalizedString message, LocalizedException innerException) : base(message, innerException)
 {
     this.FailureCode = RightsManagementPermanentException.GetRightsManagementFailureCode(innerException);
 }
Ejemplo n.º 6
0
 public RightsManagementPermanentException(RightsManagementFailureCode failureCode, LocalizedString message) : base(message)
 {
     EnumValidator.ThrowIfInvalid <RightsManagementFailureCode>(failureCode, "failureCode");
     this.FailureCode = failureCode;
 }
 public RightsManagementException(RightsManagementFailureCode failureCode, string message, Exception innerException)
 {
     throw new NotImplementedException();
 }
        private static SanitizedHtmlString GetIrmErrorDetails(UserContext userContext, RightsManagedMessageDecryptionStatus decryptionStatus)
        {
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            SanitizingStringBuilder <OwaHtml> sanitizingStringBuilder = new SanitizingStringBuilder <OwaHtml>();
            RightsManagementFailureCode       failureCode             = decryptionStatus.FailureCode;

            if (failureCode > RightsManagementFailureCode.PreLicenseAcquisitionFailed)
            {
                switch (failureCode)
                {
                case RightsManagementFailureCode.FailedToExtractTargetUriFromMex:
                case RightsManagementFailureCode.FailedToDownloadMexData:
                    sanitizingStringBuilder.Append(LocalizedStrings.GetNonEncoded(-843834599));
                    goto IL_308;

                case RightsManagementFailureCode.GetServerInfoFailed:
                    goto IL_19E;

                case RightsManagementFailureCode.InternalLicensingDisabled:
                    break;

                case RightsManagementFailureCode.ExternalLicensingDisabled:
                    sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetNonEncoded(-641698444), new object[]
                    {
                        WebReadyViewUtilities.GetOfficeDownloadAnchor(userContext.UserCulture)
                    });
                    goto IL_308;

                default:
                    switch (failureCode)
                    {
                    case RightsManagementFailureCode.ServerRightNotGranted:
                        sanitizingStringBuilder.Append(LocalizedStrings.GetNonEncoded(-271360565));
                        goto IL_308;

                    case RightsManagementFailureCode.InvalidLicensee:
                        goto IL_189;

                    case RightsManagementFailureCode.FeatureDisabled:
                        break;

                    case RightsManagementFailureCode.NotSupported:
                        sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetNonEncoded(-1308596751), new object[]
                        {
                            WebReadyViewUtilities.GetOfficeDownloadAnchor(userContext.UserCulture)
                        });
                        goto IL_308;

                    case RightsManagementFailureCode.CorruptData:
                        sanitizingStringBuilder.Append(LocalizedStrings.GetNonEncoded(-987520932));
                        goto IL_308;

                    default:
                        if (failureCode != RightsManagementFailureCode.Success)
                        {
                            goto IL_19E;
                        }
                        goto IL_308;
                    }
                    break;
                }
                sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetNonEncoded(-1308596751), new object[]
                {
                    WebReadyViewUtilities.GetOfficeDownloadAnchor(userContext.UserCulture)
                });
                goto IL_308;
            }
            if (failureCode == RightsManagementFailureCode.UserRightNotGranted)
            {
                sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetNonEncoded(149546568), new object[]
                {
                    WebReadyViewUtilities.GetOfficeDownloadAnchor(userContext.UserCulture)
                });
                goto IL_308;
            }
            if (failureCode != RightsManagementFailureCode.PreLicenseAcquisitionFailed)
            {
                goto IL_19E;
            }
IL_189:
            sanitizingStringBuilder.Append(LocalizedStrings.GetNonEncoded(-492186842));
            goto IL_308;
IL_19E:
            sanitizingStringBuilder.Append(LocalizedStrings.GetNonEncoded(-624237727));
            Exception exception = decryptionStatus.Exception;

            if (Globals.ShowDebugInformation && exception != null && exception.InnerException != null)
            {
                StringBuilder stringBuilder = new StringBuilder();
                userContext.RenderThemeImage(stringBuilder, ThemeFileId.Expand, string.Empty, new object[0]);
                sanitizingStringBuilder.AppendFormat("<div onclick=\"document.getElementById('divDtls').style.display='';this.style.display='none';adjHght();\" style=\"cursor: pointer; color: #3165cd;\">" + stringBuilder.ToString() + "&nbsp;{0}</div><div id=\"divDtls\" style='display:none'>", new object[]
                {
                    LocalizedStrings.GetNonEncoded(-610047827)
                });
                string text = string.Empty;
                RightsManagementFailureCode failureCode2 = decryptionStatus.FailureCode;
                Exception innerException = exception.InnerException;
                if (innerException is RightsManagementException)
                {
                    RightsManagementException ex = (RightsManagementException)innerException;
                    text = ex.RmsUrl;
                }
                int num = 0;
                while (num < 10 && innerException.InnerException != null)
                {
                    innerException = innerException.InnerException;
                    num++;
                }
                sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetHtmlEncoded(1633606253), new object[]
                {
                    innerException.Message
                });
                if (!string.IsNullOrEmpty(text))
                {
                    sanitizingStringBuilder.Append("<br>");
                    sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetHtmlEncoded(2115316283), new object[]
                    {
                        text
                    });
                }
                if (failureCode2 != RightsManagementFailureCode.Success)
                {
                    sanitizingStringBuilder.Append("<br>");
                    sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetHtmlEncoded(970140031), new object[]
                    {
                        failureCode2
                    });
                }
                sanitizingStringBuilder.Append("</div>");
            }
IL_308:
            return(sanitizingStringBuilder.ToSanitizedString <SanitizedHtmlString>());
        }
Ejemplo n.º 9
0
        private static string GetLocalizedFailureCodeMessage(RightsManagementFailureCode failureCode)
        {
            string result;

            switch (failureCode)
            {
            case RightsManagementFailureCode.InvalidLicense:
                result = SRID.RmExceptionInvalidLicense; break;

            case RightsManagementFailureCode.InfoNotInLicense:
                result = SRID.RmExceptionInfoNotInLicense; break;

            case RightsManagementFailureCode.InvalidLicenseSignature:
                result = SRID.RmExceptionInvalidLicenseSignature; break;

            case RightsManagementFailureCode.EncryptionNotPermitted:
                result = SRID.RmExceptionEncryptionNotPermitted; break;

            case RightsManagementFailureCode.RightNotGranted:
                result = SRID.RmExceptionRightNotGranted; break;

            case RightsManagementFailureCode.InvalidVersion:
                result = SRID.RmExceptionInvalidVersion; break;

            case RightsManagementFailureCode.InvalidEncodingType:
                result = SRID.RmExceptionInvalidEncodingType; break;

            case RightsManagementFailureCode.InvalidNumericalValue:
                result = SRID.RmExceptionInvalidNumericalValue; break;

            case RightsManagementFailureCode.InvalidAlgorithmType:
                result = SRID.RmExceptionInvalidAlgorithmType; break;

            case RightsManagementFailureCode.EnvironmentNotLoaded:
                result = SRID.RmExceptionEnvironmentNotLoaded; break;

            case RightsManagementFailureCode.EnvironmentCannotLoad:
                result = SRID.RmExceptionEnvironmentCannotLoad; break;

            case RightsManagementFailureCode.TooManyLoadedEnvironments:
                result = SRID.RmExceptionTooManyLoadedEnvironments; break;

            case RightsManagementFailureCode.IncompatibleObjects:
                result = SRID.RmExceptionIncompatibleObjects; break;

            case RightsManagementFailureCode.LibraryFail:
                result = SRID.RmExceptionLibraryFail; break;

            case RightsManagementFailureCode.EnablingPrincipalFailure:
                result = SRID.RmExceptionEnablingPrincipalFailure; break;

            case RightsManagementFailureCode.InfoNotPresent:
                result = SRID.RmExceptionInfoNotPresent; break;

            case RightsManagementFailureCode.BadGetInfoQuery:
                result = SRID.RmExceptionBadGetInfoQuery; break;

            case RightsManagementFailureCode.KeyTypeUnsupported:
                result = SRID.RmExceptionKeyTypeUnsupported; break;

            case RightsManagementFailureCode.CryptoOperationUnsupported:
                result = SRID.RmExceptionCryptoOperationUnsupported; break;

            case RightsManagementFailureCode.ClockRollbackDetected:
                result = SRID.RmExceptionClockRollbackDetected; break;

            case RightsManagementFailureCode.QueryReportsNoResults:
                result = SRID.RmExceptionQueryReportsNoResults; break;

            case RightsManagementFailureCode.UnexpectedException:
                result = SRID.RmExceptionUnexpectedException; break;

            case RightsManagementFailureCode.BindValidityTimeViolated:
                result = SRID.RmExceptionBindValidityTimeViolated; break;

            case RightsManagementFailureCode.BrokenCertChain:
                result = SRID.RmExceptionBrokenCertChain; break;

            case RightsManagementFailureCode.BindPolicyViolation:
                result = SRID.RmExceptionBindPolicyViolation; break;

            case RightsManagementFailureCode.ManifestPolicyViolation:
                result = SRID.RmExceptionManifestPolicyViolation; break;

            case RightsManagementFailureCode.BindRevokedLicense:
                result = SRID.RmExceptionBindRevokedLicense; break;

            case RightsManagementFailureCode.BindRevokedIssuer:
                result = SRID.RmExceptionBindRevokedIssuer; break;

            case RightsManagementFailureCode.BindRevokedPrincipal:
                result = SRID.RmExceptionBindRevokedPrincipal; break;

            case RightsManagementFailureCode.BindRevokedResource:
                result = SRID.RmExceptionBindRevokedResource; break;

            case RightsManagementFailureCode.BindRevokedModule:
                result = SRID.RmExceptionBindRevokedModule; break;

            case RightsManagementFailureCode.BindContentNotInEndUseLicense:
                result = SRID.RmExceptionBindContentNotInEndUseLicense; break;

            case RightsManagementFailureCode.BindAccessPrincipalNotEnabling:
                result = SRID.RmExceptionBindAccessPrincipalNotEnabling; break;

            case RightsManagementFailureCode.BindAccessUnsatisfied:
                result = SRID.RmExceptionBindAccessUnsatisfied; break;

            case RightsManagementFailureCode.BindIndicatedPrincipalMissing:
                result = SRID.RmExceptionBindIndicatedPrincipalMissing; break;

            case RightsManagementFailureCode.BindMachineNotFoundInGroupIdentity:
                result = SRID.RmExceptionBindMachineNotFoundInGroupIdentity; break;

            case RightsManagementFailureCode.LibraryUnsupportedPlugIn:
                result = SRID.RmExceptionLibraryUnsupportedPlugIn; break;

            case RightsManagementFailureCode.BindRevocationListStale:
                result = SRID.RmExceptionBindRevocationListStale; break;

            case RightsManagementFailureCode.BindNoApplicableRevocationList:
                result = SRID.RmExceptionBindNoApplicableRevocationList; break;

            case RightsManagementFailureCode.InvalidHandle:
                result = SRID.RmExceptionInvalidHandle; break;

            case RightsManagementFailureCode.BindIntervalTimeViolated:
                result = SRID.RmExceptionBindIntervalTimeViolated; break;

            case RightsManagementFailureCode.BindNoSatisfiedRightsGroup:
                result = SRID.RmExceptionBindNoSatisfiedRightsGroup; break;

            case RightsManagementFailureCode.BindSpecifiedWorkMissing:
                result = SRID.RmExceptionBindSpecifiedWorkMissing; break;

            case RightsManagementFailureCode.NoMoreData:
                result = SRID.RmExceptionNoMoreData; break;

            case RightsManagementFailureCode.LicenseAcquisitionFailed:
                result = SRID.RmExceptionLicenseAcquisitionFailed; break;

            case RightsManagementFailureCode.IdMismatch:
                result = SRID.RmExceptionIdMismatch; break;

            case RightsManagementFailureCode.TooManyCertificates:
                result = SRID.RmExceptionTooManyCertificates; break;

            case RightsManagementFailureCode.NoDistributionPointUrlFound:
                result = SRID.RmExceptionNoDistributionPointUrlFound; break;

            case RightsManagementFailureCode.AlreadyInProgress:
                result = SRID.RmExceptionAlreadyInProgress; break;

            case RightsManagementFailureCode.GroupIdentityNotSet:
                result = SRID.RmExceptionGroupIdentityNotSet; break;

            case RightsManagementFailureCode.RecordNotFound:
                result = SRID.RmExceptionRecordNotFound; break;

            case RightsManagementFailureCode.NoConnect:
                result = SRID.RmExceptionNoConnect; break;

            case RightsManagementFailureCode.NoLicense:
                result = SRID.RmExceptionNoLicense; break;

            case RightsManagementFailureCode.NeedsMachineActivation:
                result = SRID.RmExceptionNeedsMachineActivation; break;

            case RightsManagementFailureCode.NeedsGroupIdentityActivation:
                result = SRID.RmExceptionNeedsGroupIdentityActivation; break;

            case RightsManagementFailureCode.ActivationFailed:
                result = SRID.RmExceptionActivationFailed; break;

            case RightsManagementFailureCode.Aborted:
                result = SRID.RmExceptionAborted; break;

            case RightsManagementFailureCode.OutOfQuota:
                result = SRID.RmExceptionOutOfQuota; break;

            case RightsManagementFailureCode.AuthenticationFailed:
                result = SRID.RmExceptionAuthenticationFailed; break;

            case RightsManagementFailureCode.ServerError:
                result = SRID.RmExceptionServerError; break;

            case RightsManagementFailureCode.InstallationFailed:
                result = SRID.RmExceptionInstallationFailed; break;

            case RightsManagementFailureCode.HidCorrupted:
                result = SRID.RmExceptionHidCorrupted; break;

            case RightsManagementFailureCode.InvalidServerResponse:
                result = SRID.RmExceptionInvalidServerResponse; break;

            case RightsManagementFailureCode.ServiceNotFound:
                result = SRID.RmExceptionServiceNotFound; break;

            case RightsManagementFailureCode.UseDefault:
                result = SRID.RmExceptionUseDefault; break;

            case RightsManagementFailureCode.ServerNotFound:
                result = SRID.RmExceptionServerNotFound; break;

            case RightsManagementFailureCode.InvalidEmail:
                result = SRID.RmExceptionInvalidEmail; break;

            case RightsManagementFailureCode.ValidityTimeViolation:
                result = SRID.RmExceptionValidityTimeViolation; break;

            case RightsManagementFailureCode.OutdatedModule:
                result = SRID.RmExceptionOutdatedModule; break;

            case RightsManagementFailureCode.ServiceMoved:
                result = SRID.RmExceptionServiceMoved; break;

            case RightsManagementFailureCode.ServiceGone:
                result = SRID.RmExceptionServiceGone; break;

            case RightsManagementFailureCode.AdEntryNotFound:
                result = SRID.RmExceptionAdEntryNotFound; break;

            case RightsManagementFailureCode.NotAChain:
                result = SRID.RmExceptionNotAChain; break;

            case RightsManagementFailureCode.RequestDenied:
                result = SRID.RmExceptionRequestDenied; break;

            case RightsManagementFailureCode.NotSet:
                result = SRID.RmExceptionNotSet; break;

            case RightsManagementFailureCode.MetadataNotSet:
                result = SRID.RmExceptionMetadataNotSet; break;

            case RightsManagementFailureCode.RevocationInfoNotSet:
                result = SRID.RmExceptionRevocationInfoNotSet; break;

            case RightsManagementFailureCode.InvalidTimeInfo:
                result = SRID.RmExceptionInvalidTimeInfo; break;

            case RightsManagementFailureCode.RightNotSet:
                result = SRID.RmExceptionRightNotSet; break;

            case RightsManagementFailureCode.LicenseBindingToWindowsIdentityFailed:
                result = SRID.RmExceptionLicenseBindingToWindowsIdentityFailed; break;

            case RightsManagementFailureCode.InvalidIssuanceLicenseTemplate:
                result = SRID.RmExceptionInvalidIssuanceLicenseTemplate; break;

            case RightsManagementFailureCode.InvalidKeyLength:
                result = SRID.RmExceptionInvalidKeyLength; break;

            case RightsManagementFailureCode.ExpiredOfficialIssuanceLicenseTemplate:
                result = SRID.RmExceptionExpiredOfficialIssuanceLicenseTemplate; break;

            case RightsManagementFailureCode.InvalidClientLicensorCertificate:
                result = SRID.RmExceptionInvalidClientLicensorCertificate; break;

            case RightsManagementFailureCode.HidInvalid:
                result = SRID.RmExceptionHidInvalid; break;

            case RightsManagementFailureCode.EmailNotVerified:
                result = SRID.RmExceptionEmailNotVerified; break;

            case RightsManagementFailureCode.DebuggerDetected:
                result = SRID.RmExceptionDebuggerDetected; break;

            case RightsManagementFailureCode.InvalidLockboxType:
                result = SRID.RmExceptionInvalidLockboxType; break;

            case RightsManagementFailureCode.InvalidLockboxPath:
                result = SRID.RmExceptionInvalidLockboxPath; break;

            case RightsManagementFailureCode.InvalidRegistryPath:
                result = SRID.RmExceptionInvalidRegistryPath; break;

            case RightsManagementFailureCode.NoAesCryptoProvider:
                result = SRID.RmExceptionNoAesCryptoProvider; break;

            case RightsManagementFailureCode.GlobalOptionAlreadySet:
                result = SRID.RmExceptionGlobalOptionAlreadySet; break;

            case RightsManagementFailureCode.OwnerLicenseNotFound:
                result = SRID.RmExceptionOwnerLicenseNotFound; break;

            default:
                return(null);
            }
            return(SR.Get(result));
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Creates a new instance of RightsManagementException class.
 /// This constructor initializes the Message property of the new instance using the message parameter.
 /// The content of message is intended to be understood by humans.
 /// The caller of this constructor is required to ensure that this string has been localized for the current system culture.
 /// The FailureCode property is initialized using the failureCode parameter.
 /// </summary>
 /// <param name="failureCode">The FailureCode that indicates specific reason for the exception.</param>
 /// <param name="message">The message that describes the error.</param>
 public RightsManagementException(RightsManagementFailureCode failureCode, string message) : 
                                             base(message)
 {
     _failureCode = failureCode;// we do not check the validity of the failureCode range , as it might contain a generic 
                                                  //  HR code, not covered by the RightsManagementFailureCode enumeration 
 }
        // Token: 0x0600144F RID: 5199 RVA: 0x00075120 File Offset: 0x00073320
        private MessageItem CreateIrmErrorMessage()
        {
            RightsManagedMessageItem rightsManagedMessageItem = ((Item)base.XsoItem) as RightsManagedMessageItem;

            if (rightsManagedMessageItem == null)
            {
                return(null);
            }
            bool        flag        = false;
            MessageItem messageItem = MessageItem.CreateInMemory(StoreObjectSchema.ContentConversionProperties);

            if (messageItem == null)
            {
                AirSyncDiagnostics.TraceError(ExTraceGlobals.XsoTracer, null, "Failed to create in memory message item");
                return(null);
            }
            try
            {
                Item.CopyItemContent(rightsManagedMessageItem, messageItem);
                using (TextWriter textWriter = messageItem.Body.OpenTextWriter(Microsoft.Exchange.Data.Storage.BodyFormat.TextPlain))
                {
                    RightsManagementFailureCode failureCode = rightsManagedMessageItem.DecryptionStatus.FailureCode;
                    if (failureCode > RightsManagementFailureCode.PreLicenseAcquisitionFailed)
                    {
                        switch (failureCode)
                        {
                        case RightsManagementFailureCode.FailedToExtractTargetUriFromMex:
                        case RightsManagementFailureCode.FailedToDownloadMexData:
                            textWriter.Write(Strings.IRMReachNotConfiguredBodyText.ToString(rightsManagedMessageItem.Session.PreferedCulture));
                            goto IL_1F7;

                        case RightsManagementFailureCode.GetServerInfoFailed:
                            goto IL_1AF;

                        case RightsManagementFailureCode.InternalLicensingDisabled:
                        case RightsManagementFailureCode.ExternalLicensingDisabled:
                            break;

                        default:
                            switch (failureCode)
                            {
                            case RightsManagementFailureCode.ServerRightNotGranted:
                                textWriter.Write(Strings.IRMServerNotConfiguredBodyText.ToString(rightsManagedMessageItem.Session.PreferedCulture));
                                goto IL_1F7;

                            case RightsManagementFailureCode.InvalidLicensee:
                                goto IL_149;

                            case RightsManagementFailureCode.FeatureDisabled:
                                break;

                            case RightsManagementFailureCode.NotSupported:
                            case RightsManagementFailureCode.MissingLicense:
                            case RightsManagementFailureCode.InvalidLicensingLocation:
                                goto IL_1AF;

                            case RightsManagementFailureCode.CorruptData:
                                textWriter.Write(Strings.IRMCorruptProtectedMessageBodyText.ToString(rightsManagedMessageItem.Session.PreferedCulture));
                                goto IL_1F7;

                            case RightsManagementFailureCode.ExpiredLicense:
                                textWriter.Write(Strings.IRMLicenseExpiredBodyText.ToString(rightsManagedMessageItem.Session.PreferedCulture));
                                goto IL_1F7;

                            default:
                                goto IL_1AF;
                            }
                            break;
                        }
                        flag = true;
                        goto IL_1F7;
                    }
                    if (failureCode == RightsManagementFailureCode.UserRightNotGranted)
                    {
                        textWriter.Write(Strings.IRMNoViewRightsBodyText.ToString(rightsManagedMessageItem.Session.PreferedCulture));
                        goto IL_1F7;
                    }
                    if (failureCode != RightsManagementFailureCode.PreLicenseAcquisitionFailed)
                    {
                        goto IL_1AF;
                    }
IL_149:
                    textWriter.Write(Strings.IRMPreLicensingFailureBodyText.ToString(rightsManagedMessageItem.Session.PreferedCulture));
                    goto IL_1F7;
IL_1AF:
                    AirSyncDiagnostics.TraceError <string>(ExTraceGlobals.XsoTracer, null, "IRM decryption status {0}", rightsManagedMessageItem.DecryptionStatus.FailureCode.ToString());
                    textWriter.Write(Strings.IRMServerNotAvailableBodyText.ToString(rightsManagedMessageItem.Session.PreferedCulture));
                    IL_1F7 :;
                }
            }
            catch (Exception)
            {
                if (messageItem != null)
                {
                    flag = true;
                }
                throw;
            }
            finally
            {
                if (flag)
                {
                    messageItem.Dispose();
                    messageItem = null;
                }
            }
            return(messageItem);
        }
 public RightsManagementException(RightsManagementFailureCode failureCode, string message, Exception innerException)
 {
     throw new NotImplementedException ();
 }
 public RightsManagementException(RightsManagementFailureCode failureCode)
 {
     throw new NotImplementedException ();
 }
Ejemplo n.º 14
0
 public static bool ShouldMarkWCFErrorAsNegative(RightsManagementFailureCode failureCode)
 {
     return(failureCode == RightsManagementFailureCode.ServiceNotFound || failureCode == RightsManagementFailureCode.ActionNotSupported);
 }
Ejemplo n.º 15
0
 private static string GetLocalizedFailureCodeMessage(RightsManagementFailureCode failureCode)
 {
     string result;
     switch (failureCode)
     {
         case RightsManagementFailureCode.InvalidLicense:
             result=SRID.RmExceptionInvalidLicense; break;
         case RightsManagementFailureCode.InfoNotInLicense:
             result=SRID.RmExceptionInfoNotInLicense; break;
         case RightsManagementFailureCode.InvalidLicenseSignature:
             result=SRID.RmExceptionInvalidLicenseSignature; break;
         case RightsManagementFailureCode.EncryptionNotPermitted:
             result=SRID.RmExceptionEncryptionNotPermitted; break;
         case RightsManagementFailureCode.RightNotGranted:
             result=SRID.RmExceptionRightNotGranted; break;
         case RightsManagementFailureCode.InvalidVersion:
             result=SRID.RmExceptionInvalidVersion; break;
         case RightsManagementFailureCode.InvalidEncodingType:
             result=SRID.RmExceptionInvalidEncodingType; break;
         case RightsManagementFailureCode.InvalidNumericalValue:
             result=SRID.RmExceptionInvalidNumericalValue; break;
         case RightsManagementFailureCode.InvalidAlgorithmType:
             result=SRID.RmExceptionInvalidAlgorithmType; break;
         case RightsManagementFailureCode.EnvironmentNotLoaded:
             result=SRID.RmExceptionEnvironmentNotLoaded; break;
         case RightsManagementFailureCode.EnvironmentCannotLoad:
             result=SRID.RmExceptionEnvironmentCannotLoad; break;
         case RightsManagementFailureCode.TooManyLoadedEnvironments:
             result=SRID.RmExceptionTooManyLoadedEnvironments; break;
         case RightsManagementFailureCode.IncompatibleObjects:
             result=SRID.RmExceptionIncompatibleObjects; break;
         case RightsManagementFailureCode.LibraryFail:
             result=SRID.RmExceptionLibraryFail; break;
         case RightsManagementFailureCode.EnablingPrincipalFailure:
             result=SRID.RmExceptionEnablingPrincipalFailure; break;
         case RightsManagementFailureCode.InfoNotPresent:
             result=SRID.RmExceptionInfoNotPresent; break;
         case RightsManagementFailureCode.BadGetInfoQuery:
             result=SRID.RmExceptionBadGetInfoQuery; break;
         case RightsManagementFailureCode.KeyTypeUnsupported:
             result=SRID.RmExceptionKeyTypeUnsupported; break;
         case RightsManagementFailureCode.CryptoOperationUnsupported:
             result=SRID.RmExceptionCryptoOperationUnsupported; break;
         case RightsManagementFailureCode.ClockRollbackDetected:
             result=SRID.RmExceptionClockRollbackDetected; break;
         case RightsManagementFailureCode.QueryReportsNoResults:
             result=SRID.RmExceptionQueryReportsNoResults; break;
         case RightsManagementFailureCode.UnexpectedException:
             result=SRID.RmExceptionUnexpectedException; break;
         case RightsManagementFailureCode.BindValidityTimeViolated:
             result=SRID.RmExceptionBindValidityTimeViolated; break;
         case RightsManagementFailureCode.BrokenCertChain:
             result=SRID.RmExceptionBrokenCertChain; break;
         case RightsManagementFailureCode.BindPolicyViolation:
             result=SRID.RmExceptionBindPolicyViolation; break;
         case RightsManagementFailureCode.ManifestPolicyViolation:
             result=SRID.RmExceptionManifestPolicyViolation; break;
         case RightsManagementFailureCode.BindRevokedLicense:
             result=SRID.RmExceptionBindRevokedLicense; break;
         case RightsManagementFailureCode.BindRevokedIssuer:
             result=SRID.RmExceptionBindRevokedIssuer; break;
         case RightsManagementFailureCode.BindRevokedPrincipal:
             result=SRID.RmExceptionBindRevokedPrincipal; break;
         case RightsManagementFailureCode.BindRevokedResource:
             result=SRID.RmExceptionBindRevokedResource; break;
         case RightsManagementFailureCode.BindRevokedModule:
             result=SRID.RmExceptionBindRevokedModule; break;
         case RightsManagementFailureCode.BindContentNotInEndUseLicense:
             result=SRID.RmExceptionBindContentNotInEndUseLicense; break;
         case RightsManagementFailureCode.BindAccessPrincipalNotEnabling:
             result=SRID.RmExceptionBindAccessPrincipalNotEnabling; break;
         case RightsManagementFailureCode.BindAccessUnsatisfied:
             result=SRID.RmExceptionBindAccessUnsatisfied; break;
         case RightsManagementFailureCode.BindIndicatedPrincipalMissing:
             result=SRID.RmExceptionBindIndicatedPrincipalMissing; break;
         case RightsManagementFailureCode.BindMachineNotFoundInGroupIdentity:
             result=SRID.RmExceptionBindMachineNotFoundInGroupIdentity; break;
         case RightsManagementFailureCode.LibraryUnsupportedPlugIn:
             result=SRID.RmExceptionLibraryUnsupportedPlugIn; break;
         case RightsManagementFailureCode.BindRevocationListStale:
             result=SRID.RmExceptionBindRevocationListStale; break;
         case RightsManagementFailureCode.BindNoApplicableRevocationList:
             result=SRID.RmExceptionBindNoApplicableRevocationList; break;
         case RightsManagementFailureCode.InvalidHandle:
             result=SRID.RmExceptionInvalidHandle; break;
         case RightsManagementFailureCode.BindIntervalTimeViolated:
             result=SRID.RmExceptionBindIntervalTimeViolated; break;
         case RightsManagementFailureCode.BindNoSatisfiedRightsGroup:
             result=SRID.RmExceptionBindNoSatisfiedRightsGroup; break;
         case RightsManagementFailureCode.BindSpecifiedWorkMissing:
             result=SRID.RmExceptionBindSpecifiedWorkMissing; break;
         case RightsManagementFailureCode.NoMoreData:
             result=SRID.RmExceptionNoMoreData; break;
         case RightsManagementFailureCode.LicenseAcquisitionFailed:
             result=SRID.RmExceptionLicenseAcquisitionFailed; break;
         case RightsManagementFailureCode.IdMismatch:
             result=SRID.RmExceptionIdMismatch; break;
         case RightsManagementFailureCode.TooManyCertificates:
             result=SRID.RmExceptionTooManyCertificates; break;
         case RightsManagementFailureCode.NoDistributionPointUrlFound:
             result=SRID.RmExceptionNoDistributionPointUrlFound; break;
         case RightsManagementFailureCode.AlreadyInProgress:
             result=SRID.RmExceptionAlreadyInProgress; break;
         case RightsManagementFailureCode.GroupIdentityNotSet:
             result=SRID.RmExceptionGroupIdentityNotSet; break;
         case RightsManagementFailureCode.RecordNotFound:
             result=SRID.RmExceptionRecordNotFound; break;
         case RightsManagementFailureCode.NoConnect:
             result=SRID.RmExceptionNoConnect; break;
         case RightsManagementFailureCode.NoLicense:
             result=SRID.RmExceptionNoLicense; break;
         case RightsManagementFailureCode.NeedsMachineActivation:
             result=SRID.RmExceptionNeedsMachineActivation; break;
         case RightsManagementFailureCode.NeedsGroupIdentityActivation:
             result=SRID.RmExceptionNeedsGroupIdentityActivation; break;
         case RightsManagementFailureCode.ActivationFailed:
             result=SRID.RmExceptionActivationFailed; break;
         case RightsManagementFailureCode.Aborted:
             result=SRID.RmExceptionAborted; break;
         case RightsManagementFailureCode.OutOfQuota:
             result=SRID.RmExceptionOutOfQuota; break;
         case RightsManagementFailureCode.AuthenticationFailed:
             result=SRID.RmExceptionAuthenticationFailed; break;
         case RightsManagementFailureCode.ServerError:
             result=SRID.RmExceptionServerError; break;
         case RightsManagementFailureCode.InstallationFailed:
             result=SRID.RmExceptionInstallationFailed; break;
         case RightsManagementFailureCode.HidCorrupted:
             result=SRID.RmExceptionHidCorrupted; break;
         case RightsManagementFailureCode.InvalidServerResponse:
             result=SRID.RmExceptionInvalidServerResponse; break;
         case RightsManagementFailureCode.ServiceNotFound:
             result=SRID.RmExceptionServiceNotFound; break;
         case RightsManagementFailureCode.UseDefault:
             result=SRID.RmExceptionUseDefault; break;
         case RightsManagementFailureCode.ServerNotFound:
             result=SRID.RmExceptionServerNotFound; break;
         case RightsManagementFailureCode.InvalidEmail:
             result=SRID.RmExceptionInvalidEmail; break;
         case RightsManagementFailureCode.ValidityTimeViolation:
             result=SRID.RmExceptionValidityTimeViolation; break;
         case RightsManagementFailureCode.OutdatedModule:
             result=SRID.RmExceptionOutdatedModule; break;
         case RightsManagementFailureCode.ServiceMoved:
             result=SRID.RmExceptionServiceMoved; break;
         case RightsManagementFailureCode.ServiceGone:
             result=SRID.RmExceptionServiceGone; break;
         case RightsManagementFailureCode.AdEntryNotFound:
             result=SRID.RmExceptionAdEntryNotFound; break;
         case RightsManagementFailureCode.NotAChain:
             result=SRID.RmExceptionNotAChain; break;
         case RightsManagementFailureCode.RequestDenied:
             result=SRID.RmExceptionRequestDenied; break;
         case RightsManagementFailureCode.NotSet:
             result=SRID.RmExceptionNotSet; break;
         case RightsManagementFailureCode.MetadataNotSet:
             result=SRID.RmExceptionMetadataNotSet; break;
         case RightsManagementFailureCode.RevocationInfoNotSet:
             result=SRID.RmExceptionRevocationInfoNotSet; break;
         case RightsManagementFailureCode.InvalidTimeInfo:
             result=SRID.RmExceptionInvalidTimeInfo; break;
         case RightsManagementFailureCode.RightNotSet:
             result=SRID.RmExceptionRightNotSet; break;
         case RightsManagementFailureCode.LicenseBindingToWindowsIdentityFailed:
             result=SRID.RmExceptionLicenseBindingToWindowsIdentityFailed; break;
         case RightsManagementFailureCode.InvalidIssuanceLicenseTemplate:
             result=SRID.RmExceptionInvalidIssuanceLicenseTemplate; break;
         case RightsManagementFailureCode.InvalidKeyLength:
             result=SRID.RmExceptionInvalidKeyLength; break;
         case RightsManagementFailureCode.ExpiredOfficialIssuanceLicenseTemplate:
             result=SRID.RmExceptionExpiredOfficialIssuanceLicenseTemplate; break;
         case RightsManagementFailureCode.InvalidClientLicensorCertificate:
             result=SRID.RmExceptionInvalidClientLicensorCertificate; break;
         case RightsManagementFailureCode.HidInvalid:
             result=SRID.RmExceptionHidInvalid; break;
         case RightsManagementFailureCode.EmailNotVerified:
             result=SRID.RmExceptionEmailNotVerified; break;
         case RightsManagementFailureCode.DebuggerDetected:
             result=SRID.RmExceptionDebuggerDetected; break;
         case RightsManagementFailureCode.InvalidLockboxType:
             result=SRID.RmExceptionInvalidLockboxType; break;
         case RightsManagementFailureCode.InvalidLockboxPath:
             result=SRID.RmExceptionInvalidLockboxPath; break;
         case RightsManagementFailureCode.InvalidRegistryPath:
             result=SRID.RmExceptionInvalidRegistryPath; break;
         case RightsManagementFailureCode.NoAesCryptoProvider:
             result=SRID.RmExceptionNoAesCryptoProvider; break;
         case RightsManagementFailureCode.GlobalOptionAlreadySet:
             result=SRID.RmExceptionGlobalOptionAlreadySet; break;
         case RightsManagementFailureCode.OwnerLicenseNotFound:
             result=SRID.RmExceptionOwnerLicenseNotFound; break;
         default:
             return null;
     }
     return SR.Get(result);
 }
Ejemplo n.º 16
0
 public RightsManagedMessageDecryptionStatus(RightsManagementFailureCode failureCode, Exception exception)
 {
     EnumValidator.ThrowIfInvalid <RightsManagementFailureCode>(failureCode, "failureCode");
     this.failureCode = failureCode;
     this.exception   = exception;
 }
 public RightsManagementException(RightsManagementFailureCode failureCode)
 {
     throw new NotImplementedException();
 }
        /// <summary>
        /// Gets the error message corresponding to a Rights Management
        /// exception and detects whether it is fatal and whether the user
        /// should be offered a mitigation. This is a specialized version of
        /// the ParseException function.
        /// </summary>
        /// <param name="operation">The current operation</param>
        /// <param name="exception">The exception to parse</param>
        /// <param name="askUser">Whether or not the user should be given a
        /// choice to take action to prevent the failure</param>
        /// <param name="fatal">Whether or not the failure represented is fatal
        /// </param>
        /// <returns>A user-friendly message corresponding to the exception
        /// </returns>
        private static string ParseRightsManagementException(
            RightsManagementOperation operation,
            RightsManagementException rmException,
            out bool askUser,
            out bool fatal)
        {
            askUser = false;
            fatal   = true;

            RightsManagementFailureCode failureCode = rmException.FailureCode;

            string result = null;

            switch (failureCode)
            {
            case RightsManagementFailureCode.InvalidLicense:
                if (operation == RightsManagementOperation.TemplateAccess)
                {
                    result = SRID.RightsManagementWarnErrorInvalidTemplate;
                }
                else
                {
                    result = SRID.RightsManagementWarnErrorConfigurationError;
                }
                break;

            case RightsManagementFailureCode.InvalidLicenseSignature:
                if (operation == RightsManagementOperation.Initialize)
                {
                    result = SRID.RightsManagementWarnErrorConfigurationError;
                }
                else
                {
                    result = SRID.RightsManagementWarnErrorInvalidContent;
                }

                break;

            case RightsManagementFailureCode.RightNotGranted:
                result  = SRID.RightsManagementWarnErrorNoPermission;
                askUser = true;
                break;

            case RightsManagementFailureCode.InvalidVersion:
                result = SRID.RightsManagementWarnErrorConfigurationError;
                break;

            case RightsManagementFailureCode.ClockRollbackDetected:
                result = SRID.RightsManagementWarnErrorClockModified;
                break;

            case RightsManagementFailureCode.BindValidityTimeViolated:
                result = SRID.RightsManagementWarnErrorExpiredPermission;
                break;

            case RightsManagementFailureCode.BrokenCertChain:
                result = SRID.RightsManagementWarnErrorConfigurationError;
                break;

            case RightsManagementFailureCode.BindPolicyViolation:
                result  = SRID.RightsManagementWarnErrorNoPermission;
                askUser = true;
                break;

            case RightsManagementFailureCode.ManifestPolicyViolation:
                result = SRID.RightsManagementWarnErrorConfigurationError;
                break;

            case RightsManagementFailureCode.BindRevokedLicense:
                result  = SRID.RightsManagementWarnErrorNoPermission;
                askUser = true;
                break;

            case RightsManagementFailureCode.BindRevokedIssuer:
                result  = SRID.RightsManagementWarnErrorNoPermission;
                askUser = true;
                break;

            case RightsManagementFailureCode.BindRevokedPrincipal:
                result  = SRID.RightsManagementWarnErrorNoPermission;
                askUser = true;
                break;

            case RightsManagementFailureCode.BindRevokedResource:
                result  = SRID.RightsManagementWarnErrorNoPermission;
                askUser = true;
                break;

            case RightsManagementFailureCode.BindRevokedModule:
                result = SRID.RightsManagementWarnErrorConfigurationError;
                break;

            case RightsManagementFailureCode.BindAccessUnsatisfied:
                result  = SRID.RightsManagementWarnErrorNoPermission;
                askUser = true;
                break;

            case RightsManagementFailureCode.BindMachineNotFoundInGroupIdentity:
                result = SRID.RightsManagementWarnErrorConfigurationError;
                break;

            case RightsManagementFailureCode.BindRevocationListStale:
                result  = SRID.RightsManagementWarnErrorNoPermission;
                askUser = true;
                break;

            case RightsManagementFailureCode.BindNoApplicableRevocationList:
                result  = SRID.RightsManagementWarnErrorNoPermission;
                askUser = true;
                break;

            case RightsManagementFailureCode.LicenseAcquisitionFailed:
                result = SRID.RightsManagementWarnErrorConfigurationError;
                break;

            case RightsManagementFailureCode.NoDistributionPointUrlFound:
                result = SRID.RightsManagementWarnErrorInvalidContent;
                break;

            case RightsManagementFailureCode.NoConnect:
                result = SRID.RightsManagementWarnErrorServerError;
                break;

            case RightsManagementFailureCode.ActivationFailed:
                result = SRID.RightsManagementWarnErrorConfigurationError;
                break;

            case RightsManagementFailureCode.Aborted:
                fatal = (operation != RightsManagementOperation.PassportActivation);
                break;

            case RightsManagementFailureCode.OutOfQuota:
                result  = SRID.RightsManagementWarnErrorNoPermission;
                askUser = true;
                break;

            case RightsManagementFailureCode.AuthenticationFailed:
                fatal = false;
                break;

            case RightsManagementFailureCode.ServerError:
                result = SRID.RightsManagementWarnErrorServerError;
                break;

            case RightsManagementFailureCode.HidCorrupted:
                result = SRID.RightsManagementWarnErrorConfigurationError;
                break;

            case RightsManagementFailureCode.InvalidServerResponse:
                result = SRID.RightsManagementWarnErrorServerError;
                break;

            case RightsManagementFailureCode.ServiceNotFound:
                result = SRID.RightsManagementWarnErrorServerError;
                break;

            case RightsManagementFailureCode.UseDefault:
                result = SRID.RightsManagementWarnErrorConfigurationError;
                break;

            case RightsManagementFailureCode.ServerNotFound:
                result = SRID.RightsManagementWarnErrorServerError;
                break;

            case RightsManagementFailureCode.InvalidEmail:
                fatal = false;
                break;

            case RightsManagementFailureCode.ValidityTimeViolation:
                result = SRID.RightsManagementWarnErrorExpiredPermission;
                break;

            case RightsManagementFailureCode.OutdatedModule:
                result = SRID.RightsManagementWarnErrorConfigurationError;
                break;

            case RightsManagementFailureCode.ServiceMoved:
                result = SRID.RightsManagementWarnErrorServerError;
                break;

            case RightsManagementFailureCode.ServiceGone:
                result = SRID.RightsManagementWarnErrorServerError;
                break;

            case RightsManagementFailureCode.AdEntryNotFound:
                fatal = false;
                break;

            case RightsManagementFailureCode.NotAChain:
                result = SRID.RightsManagementWarnErrorConfigurationError;
                break;

            case RightsManagementFailureCode.RequestDenied:
                result = SRID.RightsManagementWarnErrorTemporaryActivationNotSupported;
                fatal  = false;
                break;

            case RightsManagementFailureCode.LicenseBindingToWindowsIdentityFailed:
                result  = SRID.RightsManagementWarnErrorNoPermission;
                askUser = true;
                break;

            case RightsManagementFailureCode.InvalidIssuanceLicenseTemplate:
                result = SRID.RightsManagementWarnErrorInvalidTemplate;
                fatal  = false;
                break;

            case RightsManagementFailureCode.ExpiredOfficialIssuanceLicenseTemplate:
                result = SRID.RightsManagementWarnErrorInvalidTemplate;
                fatal  = false;
                break;

            case RightsManagementFailureCode.InvalidClientLicensorCertificate:
                result = SRID.RightsManagementWarnErrorConfigurationError;
                break;

            case RightsManagementFailureCode.HidInvalid:
                result = SRID.RightsManagementWarnErrorConfigurationError;
                break;

            case RightsManagementFailureCode.EmailNotVerified:
                fatal = false;
                break;

            case RightsManagementFailureCode.DebuggerDetected:
                result = SRID.RightsManagementWarnErrorDebuggerDetected;
                break;

            case RightsManagementFailureCode.InvalidLockboxType:
                result = SRID.RightsManagementWarnErrorConfigurationError;
                break;

            case RightsManagementFailureCode.InvalidLockboxPath:
                result = SRID.RightsManagementWarnErrorConfigurationError;
                break;

            case RightsManagementFailureCode.NoAesCryptoProvider:
                result = SRID.RightsManagementWarnErrorConfigurationError;
                break;

            default:
                return(null);
            }

            if (result == null)
            {
                return(null);
            }
            else
            {
                return(SR.Get(result));
            }
        }
Ejemplo n.º 19
0
        private void HandleRightsManagementException(RightsManagementException e, OwaStoreObjectId messageId, string correlator)
        {
            RightsManagementFailureCode failureCode = e.FailureCode;

            if (failureCode <= RightsManagementFailureCode.PreLicenseAcquisitionFailed)
            {
                if (failureCode == RightsManagementFailureCode.UserRightNotGranted)
                {
                    this.EnqueueLicensingError(messageId, SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(-1796455575, this.userCulture), new object[]
                    {
                        string.Empty
                    }), correlator);
                    return;
                }
                if (failureCode != RightsManagementFailureCode.PreLicenseAcquisitionFailed)
                {
                    goto IL_15E;
                }
            }
            else
            {
                switch (failureCode)
                {
                case RightsManagementFailureCode.FailedToExtractTargetUriFromMex:
                case RightsManagementFailureCode.FailedToDownloadMexData:
                    this.EnqueueLicensingError(messageId, SanitizedHtmlString.FromStringId(1314141112, this.userCulture), correlator);
                    return;

                case RightsManagementFailureCode.GetServerInfoFailed:
                    goto IL_15E;

                case RightsManagementFailureCode.InternalLicensingDisabled:
                    this.EnqueueLicensingError(messageId, SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(1049269714, this.userCulture), new object[]
                    {
                        Utilities.GetOfficeDownloadAnchor(Microsoft.Exchange.Data.Storage.BodyFormat.TextHtml, this.userCulture)
                    }), correlator);
                    return;

                case RightsManagementFailureCode.ExternalLicensingDisabled:
                    this.EnqueueLicensingError(messageId, SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(1397740097, this.userCulture), new object[]
                    {
                        Utilities.GetOfficeDownloadAnchor(Microsoft.Exchange.Data.Storage.BodyFormat.TextHtml, this.userCulture)
                    }), correlator);
                    return;

                default:
                    switch (failureCode)
                    {
                    case RightsManagementFailureCode.ServerRightNotGranted:
                        this.EnqueueLicensingError(messageId, SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(784482022, this.userCulture), new object[]
                        {
                            string.Empty
                        }), correlator);
                        return;

                    case RightsManagementFailureCode.InvalidLicensee:
                        break;

                    default:
                        goto IL_15E;
                    }
                    break;
                }
            }
            this.EnqueueLicensingError(messageId, SanitizedHtmlString.FromStringId(-1489754529, this.userCulture), correlator);
            return;

IL_15E:
            SanitizingStringBuilder <OwaHtml> sanitizingStringBuilder = new SanitizingStringBuilder <OwaHtml>(LocalizedStrings.GetNonEncoded(360598592));

            sanitizingStringBuilder.Append("<br>");
            sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetHtmlEncoded(1633606253, this.userCulture), new object[]
            {
                e.Message
            });
            this.EnqueueLicensingError(messageId, sanitizingStringBuilder.ToSanitizedString <SanitizedHtmlString>(), correlator);
        }