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]