Has anybody managed to implement this part? Apple has released some reference code along with the FairPlay SDK (preview), but there are quite some missing bits. Is there any guides / tutorials, which would help / guide the implementation?
-
Have you managed to get it work? I am surprised that there are only few entries about Apple FairPlay and KSM(Key Server Module) implementation. I would be glad if you could help me. Thanks. – Barbaros Alp Jul 27 '16 at 06:42
-
same question - were you able to manage to implement it? – Tamas Kalman Mar 27 '17 at 22:04
1 Answers
The most troublesome part of the reference is that it's missing the private key which they say to just put in some array. PROBLEM: the key is in a pem file and has a textual represntation.
After a little bit of testing I was able to overcome this.
I took the relevant .pem file which starts with the line "-----BEGIN RSA PRIVATE KEY-----" and then the base64 encoded key and finishes with "-----END RSA PRIVATE KEY-----" so I just took all the data (including opening and closing lines) and converted it to a bytes represntation.
I used the following python code
file = open("dev_private_key.pem", "r")
a = file.read()
b = new bytearray(a)
for ch in b:
sys.stdout.write(str(ch)+",")
Then I took this output and just pasted it in the required line in SKDServerUtils.c so it looks something like this
static const UInt8 pKeyPem[] = {45,45,45,45,45....}
Recompiled it all and it works well for me.
Hope this helps people in the future since I couldn't find any better documentation on this specific part.

- 1,606
- 14
- 27
-
Can you elaborate, how were you able to manage the implementation. In SDK provided by apple, I can see some .h and .c files. Where to host these files? and how to manage client calling the key server module? – abhinavroy23 Aug 01 '17 at 12:12
-
1I run it with a linux system, I created my own makefile and compiled it as a shared library, then you can use whatever framework to load that library. The method you should be calling is "SKDServerGenCKC" declared in "SKDServer.h" note that there are a few places in the code you have to edit (they are clearly marked) – in need of help Aug 01 '17 at 12:59