// Token: 0x06000A1C RID: 2588 RVA: 0x00045CBC File Offset: 0x00043EBC
        private static bool IsValid(X509Certificate2 cert)
        {
            bool result = false;

            if (cert.HasPrivateKey && !InstantMessageCertUtils.IsExpired(cert) && !InstantMessageCertUtils.IsInvalidDate(cert))
            {
                result = true;
            }
            return(result);
        }
        // Token: 0x06000A17 RID: 2583 RVA: 0x00045A78 File Offset: 0x00043C78
        internal static void GetIMCertInfo(string thumbprint, out string certificateIssuer, out byte[] certificateSerial)
        {
            certificateIssuer = null;
            certificateSerial = null;
            X509Certificate2 x509Certificate = InstantMessageCertUtils.FindCertByThumbprint(ManageExchangeCertificate.UnifyThumbprintFormat(thumbprint));

            if (x509Certificate != null && InstantMessageCertUtils.IsValid(x509Certificate))
            {
                InstantMessageCertUtils.DoesCertificateExpireSoon(x509Certificate);
                certificateIssuer = x509Certificate.Issuer;
                certificateSerial = x509Certificate.GetSerialNumber();
            }
        }
Exemplo n.º 3
0
        private void ReadOcsServerSettings()
        {
            string value = ConfigurationManager.AppSettings["EnableIMForOwaPremium"];
            bool   flag  = false;
            bool   flag2;

            if (!string.IsNullOrWhiteSpace(value) && bool.TryParse(value, out flag2))
            {
                flag = flag2;
            }
            if (!flag)
            {
                ExTraceGlobals.InstantMessagingTracer.TraceDebug(0L, "Globals.ReadOcsServerSettings. OWA Premium Instant Messaging integration is disabled.");
                return;
            }
            int    mtlsPortNumber = -1;
            bool   flag3          = true;
            bool   flag4          = true;
            string text           = string.Empty;

            ExTraceGlobals.InstantMessagingTracer.TraceDebug(0L, "Globals.ReadOcsServerSettings");
            if (OwaConfigurationManager.Configuration != null)
            {
                this.ocsServerName = OwaConfigurationManager.Configuration.InstantMessagingServerName;
                if (string.IsNullOrEmpty(this.ocsServerName))
                {
                    ExTraceGlobals.InstantMessagingTracer.TraceDebug(0L, "Instant Messaging Server name is set to null or empty on the OWA Virtual Directory object.");
                    flag3 = false;
                }
                text = OwaConfigurationManager.Configuration.InstantMessagingCertificateThumbprint;
                if (string.IsNullOrEmpty(text))
                {
                    ExTraceGlobals.InstantMessagingTracer.TraceDebug(0L, "Instant Messaging Certificate Thumbprint is null or empty on the OWA Virtual Directory object.");
                    flag4 = false;
                }
            }
            if (!flag3 || !flag4)
            {
                if (OwaConfigurationManager.Configuration != null && OwaConfigurationManager.Configuration.InstantMessagingType == InstantMessagingTypeOptions.Ocs)
                {
                    if (!flag3)
                    {
                        OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_ErrorIMServerNameInvalid);
                    }
                    if (!flag4)
                    {
                        OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_ErrorIMCertificateThumbprintInvalid);
                    }
                }
                return;
            }
            InstantMessageCertUtils.GetIMCertInfo(text, out this.certificateIssuer, out this.certificateSerial);
            if (string.IsNullOrEmpty(this.certificateIssuer))
            {
                ExTraceGlobals.InstantMessagingTracer.TraceDebug(0L, "IM Certificate Issuer is null.");
                return;
            }
            if (this.certificateSerial == null)
            {
                ExTraceGlobals.InstantMessagingTracer.TraceDebug(0L, "IM Certificate Serial is null.");
                return;
            }
            string text2 = ConfigurationManager.AppSettings["IMPortNumber"];
            int    num;

            if (!string.IsNullOrEmpty(text2) && int.TryParse(text2, out num) && num >= 0)
            {
                mtlsPortNumber = num;
            }
            InstantMessageOCSProvider.InitializeEndpointManager(this.certificateIssuer, this.certificateSerial, mtlsPortNumber);
        }