title: Import Public Key from GameCenter using PyCrypto on Google App Engine
body: <p>I'm trying to verify a GameCenter player on a remote server using Apple's documented method:</p>
  
  <pre><code>GKLocalPlayer generateIdentityVerificationSignatureWithCompletionHandler:
  </code></pre>
  
  <p>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):</p>
  
  <pre><code>https://sandbox.gc.apple.com/public-key/gc-sb.cer
  </code></pre>
  
  <p>This file holds the public key that must be downloaded on the server to begin the verification process for the local GameCenter player.</p>
  
  <p>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):</p>
  
  <pre><code>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) 
  </code></pre>
  
  <p>Unfortunately, this is failing with the following message:</p>
  
  <pre><code>raise ValueError("RSA key format is not supported")
  </code></pre>
  
  <p>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.</p>
  
  <p>Also, I have setup my GAE project to use the latest version of PyCrypto, which I think is 2.6.  </p>
  
  <p>The process of getting GameCenter authentication working with Google App Engine is proving to  be very troublesome.</p>