【发布时间】:2015-01-07 01:58:34
【问题描述】:
我正在尝试使用 Apple 记录的方法验证远程服务器上的 GameCenter 播放器:
GKLocalPlayer generateIdentityVerificationSignatureWithCompletionHandler:
在 iOS 上调用此方法会返回一个指向此文件的链接(此文件位置相当静态,您可以下载它以查看其内容):
https://sandbox.gc.apple.com/public-key/gc-sb.cer
此文件包含必须下载到服务器上以开始本地 GameCenter 播放器的验证过程的公钥。
我在我的项目中使用 Google App Engine,这限制了我使用 PyCrypto 库。我正在尝试使用这些调用导入此文件(为了清楚起见,我直接在此处使用文件名):
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)
很遗憾,此操作失败并显示以下消息:
raise ValueError("RSA key format is not supported")
据我了解,PyCrypto 需要一个 DER 格式的证书,我认为这是 Apple 提供的。有谁知道我做错了什么,或者可以指出我正确的方向?谢谢。
另外,我已将我的 GAE 项目设置为使用最新版本的 PyCrypto,我认为是 2.6。
事实证明,使用 Google App Engine 获得 GameCenter 身份验证的过程非常麻烦。
【问题讨论】:
标签: ios google-app-engine game-center pycrypto