パッケージャーは、暗号化されたコンテンツに PlayReady ヘッダーを含める必要があります。
PlayReady ヘッダーと PlayReady オブジェクトの詳細については、 PlayReady ヘッダーの仕様を参照してください。
PlayReady ヘッダーには、データの暗号化に使用されるキーを識別するキー識別子 (KID)、PlayReady ライセンス サーバーの既定のライセンス取得 URL、含めるカスタム データなど、再生されるコンテンツに関する情報が含まれます。 コンテンツの暗号化に使用されるキーと KID は、その特定のコンテンツのライセンスを発行する PlayReady ライセンス サーバー (通常はキー管理システム (KMS) を通じて) と共有する必要があります。
注
Microsoft では、PlayReady でキー管理システムを提供していません。
次の XML コードは、セグメント化された MP4 ファイルのヘッダーに挿入できる PlayReady ヘッダーの例を示しています。通常はオンデマンド コンテンツ用です。 これには、クライアントがコンテンツの暗号化を解除するために必要な KID (コンテンツ暗号化キーの ID) の一覧が含まれます。 オンデマンド ファイルまたはストリームに対してこれらの KID を通知する最も一般的な方法です。
<WRMHEADER xmlns="http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader" version="4.3.0.0">
<DATA>
<PROTECTINFO>
<KIDS>
<KID ALGID="AESCTR" VALUE="PV1LM/VEVk+kEOB8qqcWDg=="></KID>
<KID ALGID="AESCTR" VALUE="tuhDoKUN7EyxDPtMRNmhyA=="></KID>
</KIDS>
</PROTECTINFO>
<LA_URL>http://rm.contoso.com/rightsmanager.asmx</LA_URL>
<DS_ID>AH+03juKbUGbHl1V/QIwRA==</DS_ID>
</DATA>
</WRMHEADER>
次の XML コードは、Live Linear コンテンツの PlayReady ヘッダーの例を示しています。 コンテンツ暗号化キー (および関連する KID) が (たとえば、非常に頻繁に、プログラムの境界で、または 1 時間ごと、または毎日) 時々変更されるため、KID は含まれません。 コンテンツ ストリームに使用される KID はセグメント ヘッダーで通知されるため、ストリーム最上位レベルの PlayReady ヘッダーに含める必要はありません。 プロパティ DECRYPTORSETUP は ONDEMAND に設定されます。つまり、PlayReady ヘッダーと Decryptor はオンデマンドで設定されます。つまり、クライアントが実際にセグメントの暗号化解除を開始する必要があるときは、この時点で、クライアントはセグメント ヘッダー内の別の PlayReady ヘッダーにアクセスして、KID が何が関係するかを把握します。
注
DECRYPTORSETUP = ONDEMAND は、コンテンツがオンデマンドで提供されるという意味ではなく、実際には逆です。
<WRMHEADER version="4.2.0.0" xmlns="http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader">
<DATA>
<DECRYPTORSETUP>ONDEMAND</DECRYPTORSETUP>
</DATA>
</WRMHEADER>
パッケージャーで PlayReady ヘッダー ジェネレーターを作成するには、複数の方法があります。 以降のセクションでは、一般的に PlayReady ヘッダーを生成する方法について説明します。
方法 1 - PlayReady ヘッダー仕様に基づいて独自のコードをビルドする
PlayReady オブジェクトとヘッダーの仕様はパブリックであるため、コンテンツをパッケージ化するために PlayReady オブジェクトと PlayReady ヘッダーを生成するコードをアプライアンスまたはサービスで記述することは、非常に簡単です。
PlayReady ヘッダー ジェネレーターには、次のような入力パラメーターが必要です。
- オンデマンド コンテンツまたはライブ リニア コンテンツ。
- 資産全体を保護するために使用される KID または KID リスト。
- 使用される暗号化の種類 (AESCTR または AESCBC)。
- LA URL をデフラウトする— パッケージ化時にライセンスを発行する PlayReady ライセンス サーバーの既定の URL です。
- サービスがドメインを使用している場合は、既定のドメイン サービス識別子。
PlayReady オブジェクトとそれに関連付けられている PlayReady ヘッダーを作成できるようになりました。 次のコード サンプルでは、オンデマンド コンテンツに使用される PlayReady ヘッダーを含む PlayReady オブジェクトを作成する方法を示します。
// This function gets values from the key management system and your specified encryption mode
// (and optionally the domainID), creates a PlayReady Header, adds the header to a
// PlayReady Object, and stores them in a file in UTF-16 little endian format
void buildRMObject(string KeyID1, string KeyID2, string encryptMode, string domainID)
{
// The string parameters include the following:
// KeyID1, KeyID2 - The key identifiers - these values are returned from the key management system or
// the KeySeed mechanism
// encryptMode - the encryption mode used to encrypt content, can be AESCTR or AESCBC
// domainID - the optional domain service identifier (only used for domains)
string xmlString = "<WRMHEADER xmlns=\"http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader\" version=\"4.3.0.0\"><DATA><PROTECTINFO><KIDS><KID ALGID=\"";
xmlString.append(encryptMode);
xmlString.append("\" VALUE=\"");
xmlString.append(KeyID1);
xmlString.append("\"></KID><KID ALGID=\"");
xmlString.append(encryptMode);
xmlString.append("\" VALUE=\"");
xmlString.append(KeyID2);
xmlString.append("\"></KID></KIDS></PROTECTINFO><LA_URL>http://rm.contoso.com/rightsmanager.asmx</LA_URL><DS_ID>");
xmlString.append(domainID);
xmlString.append("</DS_ID></DATA></WRMHEADER>");
// Convert the PlayReady header to UFT-16 format
wstring_convert<codecvt_utf8_utf16<wchar_t>> convert;
wstring utf16XML = convert.from_bytes(xmlString);
// Calculate the length of the PlayReady Header
int32_t headerLength = (utf16XML.size() * sizeof(wchar_t));
// Calculate the length of the PlayReady Object
int32_t objectLength = headerLength + 10;
// Set the number of PlayReady object records (in this case, 1)
int16_t recordCount = 1;
// Set the record type (in this case, a PlayReady Header)
// If this was an embedded license store, this value would be 3
int16_t recordType = 1;
// Write the PlayReady Object and PlayReady Header to a file
wofstream wofs("C:\\Temp\\PRObject.txt", ios::binary);
wofs.imbue(locale(wofs.getloc(),
new codecvt_utf16<wchar_t, 0x10ffff, little_endian>));
wofs.write(reinterpret_cast<const wchar_t *>(&objectLength), 2);
wofs.write(reinterpret_cast<const wchar_t *>(&recordCount), 1);
wofs.write(reinterpret_cast<const wchar_t *>(&recordType), 1);
wofs.write(reinterpret_cast<const wchar_t *>(&headerLength), 1);
wofs << utf16XML;
}
方法 2 - PlayReady サーバー API を使用する
PlayReady Server SDK のライセンシーである場合、サーバー SDK には PlayReady ヘッダーの構築に使用できる PlayReadyHeader クラスが含まれています。 これには、使用できるメソッドと、PlayReady ヘッダーに必要な情報を入力できるプロパティが含まれます。
PlayReadyHeader クラスの詳細については、PlayReady Server SDK ライセンスで受け取る PlayReady ドキュメントを参照してください。 PlayReady Server SDK には、PlayReady ヘッダーの作成方法を示すサンプル パッケージャー (AESPackaging) も含まれています。
方法 1 と同様に、キー管理システムによって生成された KeyID、暗号化の種類 (AESCTR または AESCBC)、PlayReady ライセンス サーバーの URL、必要に応じてドメイン サービス識別子が必要になります。
方法 3 - Windows アプリケーションを使用する
開始する前に必要なもの。
- キー管理システムによって生成された KeyID が必要です。
- 暗号化の種類 (AESCTR または AESCBC) を知っている必要があります。
- Windows 10 PlayReadyContentHeader クラスを使用して、 PlayReady オブジェクト内に PlayReady ヘッダーを 作成します。
前の方法と同様に、キー管理システムによって生成された KeyID、暗号化の種類 (AESCTR または AESCBC)、PlayReady ライセンス サーバーの URL、必要に応じてドメイン サービス識別子が必要になります。