FairPlay KSM
1.0.0
Fairplay-KSM เป็นการใช้งาน Netcore ของโปรโตคอล Apple DRM จากข้อมูลของ Apple ระบุว่า Fairplay Streaming (FPS) ส่งมอบกุญแจไปยังอุปกรณ์มือถือของ Apple, Apple TV และ Safari บน MacOS ซึ่งจะช่วยให้สามารถเล่นเนื้อหาวิดีโอที่เข้ารหัสได้
การใช้งานนี้สามารถใช้เป็นใบอนุญาตหรือดีบัก SPC-CKC (นำไปใช้บางส่วน)
Fairplay ได้รับการบรรจุเป็นแพ็คเกจ NUGET ดังนั้นคุณจะต้องรวมแพ็คเกจ FoolishTech.FairPlay ไว้ในโครงการของคุณเท่านั้น
dotnet add package FoolishTech.FairPlay
ก่อนใช้โมดูลคุณต้องขอแพ็คเกจการปรับใช้กับ Apple
หลังจากนั้นคุณสามารถเรียกใช้เซิร์ฟเวอร์ลิขสิทธิ์ HTTP ของคุณเอง ตรวจสอบตัวอย่างของเรา
using System ;
using System . Text ;
using System . Threading . Tasks ;
using FoolishTech . FairPlay ;
using FoolishTech . FairPlay . Models ;
using FoolishTech . FairPlay . Interfaces ;
using FoolishTech . FairPlay . Exceptions ;
namespace FoolishTech . SimpleExpeditor
{
public class HardcodedKeyLocator : IContentKeyLocator
{
Task < IContentKey > IContentKeyLocator . FetchContentKey ( byte [ ] contentId , object info /* Object passed on GenerateCKC */ )
{
string id = Encoding . UTF8 . GetString ( contentId ) ;
if ( id . Equals ( "twelve" ) ) return Task . FromResult < IContentKey > ( new FPStaticKey ( "3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C" , "D5FBD6B82ED93E4EF98AE40931EE33B7" ) ) ;
else throw new ArgumentOutOfRangeException ( nameof ( contentId ) , $ "We can't find key for content id $ { contentId } " ) ;
}
}
public class SimpleFairPlay
{
public async Task < byte [ ] > Resolve ( byte [ ] spc )
{
try {
FPProvider provider = new FPProvider ( new byte [ ] { /* Certificate+PrivKey P12 */ } , "" /* P12 Passphrase */ , new byte [ ] { /* ASK */ } ) ;
IContentKeyLocator locator = new HardcodedKeyLocator ( ) ;
FPServer server = new FPServer ( provider , locator ) ;
return await server . GenerateCKC ( spc , new Object ( ) ) ;
} catch ( FPKeyLocatorException ) {
// Exception throwed on IContentKeyLocator
} catch ( Exception ) {
// Any other exception.
}
return null ;
}
}
} ใช่! เปิดคำขอดึง : D
Diego Fernández - [email protected]