Example #1
0
        public async void Test_DeleteLicenses(string strKeyId, string strEncryptionType, string strExpectedError)
        {
            TestLogger.LogMessage("Enter Test_DeleteLicenses()");

            strExpectedError = ActionParamConvertToString(strExpectedError);
            bool bTestActionResult = true;

            try
            {
                Guid keyIdGuid = ActionParamConvertToGuid(strKeyId);
                PlayReadyEncryptionAlgorithm alg = ActionParamConvertToPlayReadyEncryptionAlgorithm(strEncryptionType);
                await LicenseManagement.DeleteLicenses(keyIdGuid, string.Empty, alg);
            }
            catch (Exception ex)
            {
                TestLogger.LogMessage("Test_DeleteLicenses Exception = " + ex.Message);
                if (strExpectedError != null && ex.Message.ToLower().Contains(strExpectedError.ToLower()))
                {
                    TestLogger.LogMessage("'" + ex.Message + "' Contains " + strExpectedError + "  as expected");
                    bTestActionResult = true;
                }
                else
                {
                    bTestActionResult = false;
                }
            }

            TestLogger.LogMessage("Leave Test_DeleteLicenses()");
            TestActionFinished(bTestActionResult, null);
        }
 public extern PlayReadyContentHeader(
     Guid contentKeyId,
     string contentKeyIdString,
     PlayReadyEncryptionAlgorithm contentEncryptionAlgorithm,
     Uri licenseAcquisitionUrl,
     Uri licenseAcquisitionUserInterfaceUrl,
     string customAttributes,
     Guid domainServiceId);
Example #3
0
        public PlayReadyEncryptionAlgorithm ActionParamConvertToPlayReadyEncryptionAlgorithm(string strEncryptionAlgorithm)
        {
            PlayReadyEncryptionAlgorithm encryptionAlgorithm = PlayReadyEncryptionAlgorithm.Unprotected;

            if (!String.IsNullOrEmpty(strEncryptionAlgorithm) && strEncryptionAlgorithm != "null")
            {
                encryptionAlgorithm = (PlayReadyEncryptionAlgorithm)Enum.Parse(typeof(PlayReadyEncryptionAlgorithm), strEncryptionAlgorithm, true);
            }
            return(encryptionAlgorithm);
        }
        static public async Task DeleteLicenses(Guid keyId, string keyIdString, PlayReadyEncryptionAlgorithm algorithm)
        {
            TestLogger.LogMessage("Enter LicenseManagement.DeleteLicenses()");
            TestLogger.LogMessage("PlayReadyEncryptionType = " + algorithm.ToString());

            PlayReadyContentHeader contentHeader = new PlayReadyContentHeader(
                keyId,
                keyIdString,
                algorithm,
                null,
                null,
                String.Empty,
                Guid.Empty);

            TestLogger.LogMessage("Deleting licenses...");
            await PlayReadyLicenseManagement.DeleteLicenses(contentHeader);

            TestLogger.LogMessage("Leave LicenseManagement.DeleteLicenses()");
        }
Example #5
0
        public async void Test_HeaderWithEmbeddedUpdates(string strKeyId,
                                                         string strEncryptionAlgorithm,
                                                         string strLAURL,
                                                         string strServiceID,
                                                         string strExpectFailure)
        {
            TestLogger.LogMessage(" ");
            TestLogger.LogMessage("Enter Test_HeaderWithEmbeddedUpdates()");
            bool bActionSucceeded = false;

            Guid keyIdGuid     = ActionParamConvertToGuid(strKeyId);
            Uri  uriLA         = ActionParamConvertToUri(strLAURL);
            Guid guidServiceId = ActionParamConvertToGuid(strServiceID);

            PlayReadyEncryptionAlgorithm encryptionAlgorithm = ActionParamConvertToPlayReadyEncryptionAlgorithm(strEncryptionAlgorithm);

            TestLogger.LogMessage("Creating PlayReadyContentHeader..");
            PlayReadyContentHeader contentHeader = new PlayReadyContentHeader(
                keyIdGuid,
                string.Empty,
                encryptionAlgorithm,
                uriLA,
                uriLA,
                String.Empty,
                guidServiceId);

            TestLogger.LogMessage("Getting HeaderWithEmbeddedUpdates..");
            PlayReadyContentHeader contentHeaderWithEmbeddedUpdates = contentHeader.HeaderWithEmbeddedUpdates;

            if (contentHeaderWithEmbeddedUpdates == null)
            {
                TestLogger.LogMessage("HeaderWithEmbeddedUpdates not available");
                if (strExpectFailure.ToLower() == "true")
                {
                    bActionSucceeded = true;
                }
            }
            else
            {
                byte[] headerBytes = contentHeaderWithEmbeddedUpdates.GetSerializedHeader();

                TestLogger.LogMessage("HeaderWithEmbeddedUpdates:");

                Windows.Storage.StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
                StorageFile HeaderWithEmbeddedLicenseFile = await localFolder.CreateFileAsync("HeaderWithEmbeddedLicense.bin",
                                                                                              CreationCollisionOption.ReplaceExisting);

                await FileIO.WriteBytesAsync(HeaderWithEmbeddedLicenseFile, headerBytes);

                string strHeader = Encoding.UTF8.GetString(headerBytes, 0, headerBytes.Length);

                if (strHeader.Contains("EST") && strHeader.Contains("XMR"))
                {
                    TestLogger.LogMessage("Header contains EST and XMR");
                    bActionSucceeded = true;
                }
                else
                {
                    TestLogger.LogMessage("Header doesn't contains EST and XMR");
                }
            }

            TestActionFinished(bActionSucceeded, null);
            TestLogger.LogMessage("Leave Test_HeaderWithEmbeddedUpdates()");
        }