FairPlay KSM
1.0.0
FairPlay-KSM是Apple DRM協議的NetCore實施。根據Apple的說法,Fairplay流媒體(FPS)將MacOS上的Apple移動設備,Apple TV和Safari安全地提供鑰匙,這將使播放加密的視頻內容播放。
該實施可以用作許可證巡邏器或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
迭戈·費爾南德斯 - [email protected]