예제 #1
0
        //This API works the same as AESContentKey constructor in PlayReady Server SDK
        public static string GetPlayReadyContentKeyFromKeyIdKeySeed(string keyIdString, string keySeedB64)
        {
            Guid keyId = new Guid(keyIdString);

            byte[] keySeed = Convert.FromBase64String(keySeedB64);

            byte[] contentKey = CommonEncryption.GeneratePlayReadyContentKey(keySeed, keyId);

            string contentKeyB64 = Convert.ToBase64String(contentKey);

            return(contentKeyB64);
        }
        public void PlayReadyContentKeyGenerationKnownGoodTest()
        {
            string _keySeed            = "XVBovsmzhP9gRIZxWfFta3VVRPzVEWmJsazEJ46I";
            string _knownGoodGuid      = "339C45B5-FB6D-4BD9-994C-EABD9D41C95B";
            string _wellKnownKeyString = "pTfNwMplhBQG1SXnvyLXVA==";

            byte[] keySeedInBinary = Convert.FromBase64String(_keySeed);
            Guid   wellKnownGuid   = new Guid(_knownGoodGuid);

            byte[] generatedKey = CommonEncryption.GeneratePlayReadyContentKey(keySeedInBinary, wellKnownGuid);

            string generatedKeyAsString = Convert.ToBase64String(generatedKey);

            Assert.AreEqual <string>(_wellKnownKeyString, generatedKeyAsString);
        }