Esempio n. 1
0
        private async void SendSecureStopRecords()
        {
            if (publisherCert == null)
            {
                return;
            }

            //// The following code will send all secure stop sessions at once
            var secureStopRequest = new PlayReadySecureStopServiceRequest(publisherCert);

            // setting the uri is optional. the uri defaults to whats in the cert
            try
            {
                secureStopRequest.Uri = new Uri(secureStopServiceUrl);
                await secureStopRequest.BeginServiceRequest();
            }
            catch (Exception e)
            {
                ViewModelBase.Log(e.Message);
            }


            // The following code can be used to iterate the secure stop sessions
            // which can be then be processed individually
            //PlayReadySecureStopIterable secureStopIterable = new PlayReadySecureStopIterable(publisherCert);
            //foreach (var secureStopReq in secureStopIterable)
            //{
            //    secureStopReq.Uri = new Uri(secureStopServiceUrl);
            //    await secureStopReq.BeginServiceRequest();
            //}
        }
Esempio n. 2
0
        public void SecureStopProactively()
        {
            Debug.WriteLine("Enter SecureStop.SecureStopReportProactively()");
            try
            {
                Debug.WriteLine("Creating SecureStop report service request...");

                PlayReadySecureStopIterable secureStopIterable = new PlayReadySecureStopIterable(_SecureStopCert);

                PlayReadySecureStopServiceRequest SecureStopRequest = secureStopIterable.First() as PlayReadySecureStopServiceRequest;

                //PlayReadySecureStopServiceRequest SecureStopRequest = new PlayReadySecureStopServiceRequest(_SecureStopCert);
                SecureStopReactively(SecureStopRequest);
            }
            catch (Exception ex)
            {
                if (ex.HResult == ServiceRequest.MSPR_E_NEEDS_INDIVIDUALIZATION)
                {
                    PlayReadyIndividualizationServiceRequest indivServiceRequest = new PlayReadyIndividualizationServiceRequest();

                    RequestChain requestChain = new RequestChain(indivServiceRequest);
                    requestChain.FinishAndReportResult(new ReportResultDelegate(HandleIndivServiceRequest_Finished));
                }
                else
                {
                    Debug.WriteLine("SecureStopProactively failed:" + ex.HResult);
                }
            }

            Debug.WriteLine("Leave SecureStop.SecureStopReportProactively()");
        }
Esempio n. 3
0
        protected virtual void SecureStopServiceRequestCompleted(PlayReadySecureStopServiceRequest sender, Exception hrCompletionStatus)
        {
            Debug.WriteLine("SecureStopServiceRequestCompleted");

            if (hrCompletionStatus != null)
            {
                Debug.WriteLine("SecureStopServiceRequestCompleted failed with " + hrCompletionStatus.HResult);
            }
        }
Esempio n. 4
0
        protected virtual void SecureStopServiceRequestCompleted(PlayReadySecureStopServiceRequest sender, Exception hrCompletionStatus)
        {
            TestLogger.LogImportantMessage("SecureStopServiceRequestCompleted");

            if (hrCompletionStatus != null)
            {
                TestLogger.LogError("SecureStopServiceRequestCompleted failed with " + hrCompletionStatus.HResult);
            }
        }
Esempio n. 5
0
        async public void SecureStopReactively(PlayReadySecureStopServiceRequest SecureStopRequest)
        {
            Debug.WriteLine("Enter SecureStop.SecureStopReportReactively()");
            Exception exception = null;

            try
            {
                _serviceRequest = SecureStopRequest;
                ConfigureServiceRequest();

                Debug.WriteLine("ChallengeCustomData = " + SecureStopRequest.ChallengeCustomData);
                if (RequestConfigData.ManualEnabling)
                {
                    Debug.WriteLine("Manually posting the request...");

                    HttpHelper httpHelper = new HttpHelper(SecureStopRequest);
                    await httpHelper.GenerateChallengeAndProcessResponse();
                }
                else
                {
                    Debug.WriteLine("Begin SecureStop service request...");
                    await SecureStopRequest.BeginServiceRequest();
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Saving exception..");
                exception = ex;
            }
            finally
            {
                Debug.WriteLine("Post-SecureStop Values:");
                if (exception == null)
                {
                    Debug.WriteLine("ResponseCustomData = " + SecureStopRequest.ResponseCustomData);
                    Debug.WriteLine("ProtectionSystem   = " + SecureStopRequest.ProtectionSystem.ToString());
                    Debug.WriteLine("Type = " + SecureStopRequest.Type.ToString());
                }

                SecureStopServiceRequestCompleted(SecureStopRequest, exception);
            }

            Debug.WriteLine("Leave SecureStop.SecureStopReportReactively()");
        }
Esempio n. 6
0
        protected override void SecureStopServiceRequestCompleted(PlayReadySecureStopServiceRequest SecureStopRequest, Exception hrCompletionStatus)
        {
            Debug.WriteLine("Enter SecureStopAndReportResult.SecureStopServiceRequestCompleted()");

            if (hrCompletionStatus != null)
            {
                if (PerformEnablingActionIfRequested(hrCompletionStatus) || HandleExpectedError(hrCompletionStatus))
                {
                    Debug.WriteLine("Exception handled.");
                }
                else
                {
                    Debug.WriteLine("SecureStopServiceRequestCompleted ERROR: " + hrCompletionStatus.ToString());
                    _reportResult(false, null);
                }
            }

            Debug.WriteLine("Leave SecureStopAndReportResult.SecureStopServiceRequestCompleted()");
        }
Esempio n. 7
0
        void ConfigureServiceRequest()
        {
            PlayReadySecureStopServiceRequest SecureStopRequest = _serviceRequest as PlayReadySecureStopServiceRequest;

            Debug.WriteLine(" ");
            Debug.WriteLine("Configure SecureStop request to these values:");
            if (RequestConfigData.Uri != null)
            {
                Debug.WriteLine("URL       :" + RequestConfigData.Uri.ToString());
                SecureStopRequest.Uri = RequestConfigData.Uri;
            }

            if (RequestConfigData.ChallengeCustomData != null && RequestConfigData.ChallengeCustomData != String.Empty)
            {
                Debug.WriteLine("ChallengeCustomData:" + RequestConfigData.ChallengeCustomData);
                SecureStopRequest.ChallengeCustomData = RequestConfigData.ChallengeCustomData;
            }

            Debug.WriteLine(" ");
        }
        private async void SendSecureStopRecords()
        {
            if (publisherCert == null) { return; }

            //// The following code will send all secure stop sessions at once
            var secureStopRequest = new PlayReadySecureStopServiceRequest(publisherCert);
            // setting the uri is optional. the uri defaults to whats in the cert
            try
            {
                secureStopRequest.Uri = new Uri(secureStopServiceUrl);
                await secureStopRequest.BeginServiceRequest();
            }
            catch (Exception e)
            {

                ViewModelBase.Log(e.Message);
            }


            // The following code can be used to iterate the secure stop sessions 
            // which can be then be processed individually
            //PlayReadySecureStopIterable secureStopIterable = new PlayReadySecureStopIterable(publisherCert);
            //foreach (var secureStopReq in secureStopIterable)
            //{
            //    secureStopReq.Uri = new Uri(secureStopServiceUrl);
            //    await secureStopReq.BeginServiceRequest();
            //}
        }