public override byte[] GetTenantActiveCryptoMode(int version, byte[] inputParameterBytes)
        {
            GetTenantActiveCryptoModeRpcParameters getTenantActiveCryptoModeRpcParameters = null;

            byte[] result;
            try
            {
                getTenantActiveCryptoModeRpcParameters = new GetTenantActiveCryptoModeRpcParameters(inputParameterBytes);
                int tenantActiveCryptoMode = ServerManager.GetTenantActiveCryptoMode(getTenantActiveCryptoModeRpcParameters.ClientManagerContext);
                ActiveCryptoModeResult[] originalResults = new ActiveCryptoModeResult[]
                {
                    new ActiveCryptoModeResult(tenantActiveCryptoMode, null)
                };
                GetTenantActiveCryptoModeRpcResults getTenantActiveCryptoModeRpcResults = new GetTenantActiveCryptoModeRpcResults(new OverallRpcResult(null), originalResults);
                result = getTenantActiveCryptoModeRpcResults.Serialize();
            }
            catch (Exception ex)
            {
                if (!(ex is RightsManagementServerException))
                {
                    ServerManagerLog.LogEvent(ServerManagerLog.Subcomponent.RpcServerWrapper, ServerManagerLog.EventType.Error, (getTenantActiveCryptoModeRpcParameters != null) ? getTenantActiveCryptoModeRpcParameters.ClientManagerContext : null, string.Format("ServerManager.GetTenantActiveCryptoMode has thrown unhandled exception {0}", ServerManagerLog.GetExceptionLogString(ex, ServerManagerLog.ExceptionLogOption.IncludeStack | ServerManagerLog.ExceptionLogOption.IncludeInnerException)));
                    ExWatson.SendReportAndCrashOnAnotherThread(ex);
                }
                GetTenantActiveCryptoModeRpcResults getTenantActiveCryptoModeRpcResults2 = new GetTenantActiveCryptoModeRpcResults(new OverallRpcResult(ex), Array <ActiveCryptoModeResult> .Empty);
                result = getTenantActiveCryptoModeRpcResults2.Serialize();
            }
            return(result);
        }
 internal ActiveCryptoModeRpcResult(ActiveCryptoModeResult originalResult)
 {
     if (originalResult == null)
     {
         throw new ArgumentNullException("originalResult");
     }
     this.ActiveCryptoMode = originalResult.ActiveCryptoMode;
     if (originalResult.Error != null)
     {
         this.isPermanentFailure = originalResult.Error.IsPermanentFailure;
         this.wellKnownErrorCode = originalResult.Error.WellKnownErrorCode;
         this.errorResults       = ErrorResult.GetErrorResultListFromException(originalResult.Error);
     }
 }
Example #3
0
 public static int GetTenantActiveCryptoMode(RmsClientManagerContext clientContext)
 {
     ArgumentValidator.ThrowIfNull("clientContext", clientContext);
     ServerManager.InitializeIfNeeded();
     if (ServerManager.instance.isHostingInstance)
     {
         PerTenantRMSTrustedPublishingDomainConfiguration tenantTrustedPublishingDomainConfig = ServerManager.instance.GetTenantTrustedPublishingDomainConfig(clientContext);
         return(tenantTrustedPublishingDomainConfig.ActiveCryptoMode);
     }
     ActiveCryptoModeRpcResult[] tenantActiveCryptoMode = RpcClientWrapper.GetTenantActiveCryptoMode(clientContext);
     ActiveCryptoModeResult[]    array = new ActiveCryptoModeResult[tenantActiveCryptoMode.Length];
     for (int i = 0; i < tenantActiveCryptoMode.Length; i++)
     {
         RightsManagementServerException e = null;
         if (tenantActiveCryptoMode[i].ErrorResults != null && tenantActiveCryptoMode[i].ErrorResults.Count > 0)
         {
             e = new RightsManagementServerException(tenantActiveCryptoMode[i].GetSerializedString(), tenantActiveCryptoMode[i].IsPermanentFailure);
         }
         array[i] = new ActiveCryptoModeResult(tenantActiveCryptoMode[i].ActiveCryptoMode, e);
     }
     return(array[0].ActiveCryptoMode);
 }