다음을 통해 공유


PlayReady 헤더를 생성하는 방법

패키지는 암호화된 콘텐츠에 PlayReady 헤더를 포함해야 합니다.

PlayReady 헤더 및 PlayReady 개체에 대한 자세한 설명은 PlayReady 헤더 사양을 참조하세요.

PlayReady 헤더에는 데이터를 암호화하는 데 사용되는 키, PlayReady 라이선스 서버의 기본 라이선스 획득 URL 및 포함하려는 사용자 지정 데이터를 식별하는 키 식별자(KID)를 포함하여 재생 중인 콘텐츠에 대한 정보가 포함됩니다. 콘텐츠를 암호화하는 데 사용되는 키와 KID는 일반적으로 키 관리 시스템(KMS)을 통해 특정 콘텐츠에 대한 라이선스를 발급하는 PlayReady 라이선스 서버와 공유되어야 합니다.

참고

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 코드는 라이브 선형 콘텐츠에 대한 PlayReady 헤더의 예를 제공합니다. 콘텐츠 암호화 키(및 관련 KID)가 가끔(예: 매우 자주 또는 프로그램 경계에서, 또는 매시간 또는 매일) 변경되기 때문에 KID는 포함되지 않습니다. 콘텐츠 스트림에 사용되는 KID는 세그먼트 헤더에 신호를 보내며 스트림 최상위 PlayReady 헤더에 포함할 필요가 없습니다. DECRYPTORSETUP 속성은 ONDEMAND로 설정됩니다. 즉, PlayReady 헤더 및 암호 해독기는 요청 시 설정됩니다. 즉, 클라이언트가 실제로 세그먼트 암호 해독을 시작해야 하는 경우를 의미하며, 이 시점에서 클라이언트는 세그먼트 헤더의 다른 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 서버 SDK 라이선스 사용자인 경우 서버 SDK에는 PlayReady 헤더를 생성하는 데 사용할 수 있는 PlayReadyHeader 클래스가 포함되어 있습니다. 여기에는 사용할 수 있는 메서드와 PlayReady 헤더에 필요한 정보로 채울 수 있는 속성이 포함됩니다.

PlayReadyHeader 클래스는 PlayReady 서버 SDK 라이선스로 받은 PlayReady 설명서에 자세히 설명되어 있습니다. PlayReady 서버 SDK에는 PlayReady 헤더를 만드는 방법을 보여 주는 샘플 패키저(AESPackaging)도 포함되어 있습니다.

방법 1에서와 같이 키 관리 시스템에서 생성한 KeyID, 암호화 유형(AESCTR 또는 AESCBC), PlayReady 라이선스 서버의 URL 및 선택적으로 도메인 서비스 식별자가 필요합니다.

방법 3 - Windows 애플리케이션 사용

시작하기 전에 필요한 사항입니다.

  1. 키 관리 시스템에서 생성된 KeyID가 있어야 합니다.
  2. 암호화 유형(AESCTR 또는 AESCBC)을 알고 있어야 합니다.
  3. Windows 10 PlayReadyContentHeader 클래스를 사용하여 PlayReady 개체 내에 PlayReady 헤더를 만듭니다.

이전 방법과 마찬가지로 키 관리 시스템에서 생성한 KeyID, 암호화 유형(AESCTR 또는 AESCBC), PlayReady 라이선스 서버의 URL 및 선택적으로 도메인 서비스 식별자가 필요합니다.