Fairplay SPC请求返回nil

时间:2015-07-06 20:27:17

标签: ios objective-c fairplay

我正在尝试使用[AVAssetResourceLoadingRequest streamingContentKeyRequestDataForApp:contentIdentifier:options:error:];获取SPC密钥的方法,但是我将nil返回给我而不是预期的SPC值。我主要引用提供的示例Fairplay应用程序。我使用编码的请求URL主机字符串作为内容标识符,并使用从SPC服务器检索的.DER证书作为应用程序数据。还有其他人遇到过这个问题吗?

NSString *hostString = [URL host];  
NSData *assetId        = [NSData dataWithBytes:[hostString cStringUsingEncoding:NSUTF8StringEncoding] length:[hostString lengthOfBytesUsingEncoding:NSUTF8StringEncoding]];  
NSData *certificate = (obtained via Key Server).  

NSError *error;  
NSData *SPC = [loadingRequest streamingContentKeyRequestDataForApp:certificate contentIdentifier:assetId options:nil error:&error]  

此处SPC的输出为零。完整的错误描述如下:

Error Domain=AVFoundationErrorDomain  
Code=-11800 "The operation could not be completed"   
UserInfo=0x170461980  
{NSUnderlyingError=0x1740548e0 "The operation couldn’t be completed. (OSStatus error -12640.)",  
NSLocalizedFailureReason=An unknown error occurred (-12640),  
NSLocalizedDescription=The operation could not be completed}  

1 个答案:

答案 0 :(得分:0)

事实证明,使用SAMPLE-AES加密未正确加密测试流。