Fairplay SPC request returns nil
I'm trying to use the [AVAssetResourceLoadingRequest streamingContentKeyRequestDataForApp: contentIdentifier: options: error:]; method to get SPC key, but I get null returned to me instead of target SPC value. I am mainly linking to the provided Fairplay sample application. I am using url host encoded string as content id and .DER certificate obtained from SPC server as application data. Has anyone else experienced this problem?
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]
The SPC output is zero here. The full description of the error is as follows:
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}
+3
source to share