I'm trying to verify a GameCenter player on a remote server using Apple's documented method:
GKLocalPlayer generateIdentityVerificationSignatureWithCompletionHandler:
Calling this method on iOS returns, among other things, a link to this file (this file location is fairly static, and you can download it to see its contents):
https://sandbox.gc.apple.com/public-key/gc-sb.cer
This file holds the public key that must be downloaded on the server to begin the verification process for the local GameCenter player.
I am using Google App Engine for my project, which limits me to using the PyCrypto library. I am trying to import this file using these calls (I use the filename directly here for clarity):
from Crypto.PublicKey import RSA
apple_cert = urllib2.urlopen("https://sandbox.gc.apple.com/public-key/gc-sb.cer").read()
rsakey = RSA.importKey(apple_cert)
Unfortunately, this is failing with the following message:
raise ValueError("RSA key format is not supported")
From what I understand, PyCrypto is expecting a DER formatted certificate, which is what I think Apple is supplying. Does anyone know what I'm doing wrong, or can point me in the right direction? Thanks.
Also, I have setup my GAE project to use the latest version of PyCrypto, which I think is 2.6.
The process of getting GameCenter authentication working with Google App Engine is proving to be very troublesome.