在服务器上获取用于 GameCenter 3rd 方身份验证的 public 密钥的位置

Where to obtain public key for GameCenter 3rd party authentication on a server

什么是 url 获取 Apple public 密钥?

这个不行:https://sandbox.gc.apple.com/public-key/gc-sb-2.cer

我只找到这样的例子 url 由客户端本身传递:

How to authenticate the GKLocalPlayer on my 'third party server'?

记录方式如下: https://developer.apple.com/library/ios/documentation/GameKit/Reference/GKLocalPlayer_Ref/index.html#//apple_ref/doc/uid/TP40009587-CH1-SW25

  1. Send the publicKeyURL, signature, salt, and timestamp parameters to the third party server used for authentication.
  2. Use the publicKeyURL on the third party server to download the public key.

当然,出于安全原因,我不能使用它。

我不明白这个问题。您从对 generateIdentityVerificationSignatureWithCompletionHandler 的调用中获得 URL。我自己还没有这样做,但我猜你在你的应用程序中调用了那个函数,然后你得到了 URL 和其他东西。您将其发送到您的服务器,然后服务器可以按照 https://developer.apple.com/library/ios/documentation/GameKit/Reference/GKLocalPlayer_Ref/index.html#//apple_ref/doc/uid/TP40009587-CH1-SW25

中所述验证用户身份

URL 不是常量,尽管可能是伪常量。您应使用传递给您的URL。

为了避免 CSRF 攻击,我只检查 url 和 uri.DnsSafeHost.EndsWith(".gc.apple.com", StringComparison.OrdinalIgnoreCase)