コード例 #1
0
ファイル: SignedCertificateTest.php プロジェクト: genkgo/push
 public function test()
 {
     $signedCertificate = SignedCertificate::fromBinaryEncodedDer(file_get_contents(__DIR__ . '/../../Stubs/signed.certificate.cer'));
     $this->assertTrue(is_resource($signedCertificate->asResource()));
     $this->assertStringStartsWith('-----BEGIN CERTIFICATE-----', (string) $signedCertificate);
 }
コード例 #2
0
ファイル: PortalConnection.php プロジェクト: genkgo/push
 /**
  * @param SigningRequest $request
  * @param Type $type
  * @param $appIdId
  * @return SignedCertificate
  * @throws ApplePortalException
  */
 public function signCertificate(SigningRequest $request, Type $type, $appIdId)
 {
     $this->initialize();
     $createCertificateResponse = $this->client->post('https://developer.apple.com/services-account/QH65B2/account/ios/certificate/submitCertificateRequest.action', ['cookies' => $this->cookieJar, 'headers' => $this->csrfTokens, 'form_params' => ['teamId' => $this->teamId, 'type' => (string) $type, 'csrContent' => (string) $request, 'appIdId' => $appIdId]]);
     $certificatePayload = (string) $createCertificateResponse->getBody();
     if (strpos($certificatePayload, 'already')) {
         throw new ApplicationAlreadyHasPushCertificateException('There are too many push certificates for this app');
     }
     $certificateJson = json_decode($certificatePayload, true);
     $certificateId = $certificateJson['certRequest']['certificate']['certificateId'];
     $certificateDownloadResponse = $this->client->get('https://developer.apple.com/services-account/QH65B2/account/ios/certificate/downloadCertificateContent.action', ['cookies' => $this->cookieJar, 'headers' => $this->csrfTokens, 'query' => ['teamId' => $this->teamId, 'type' => (string) $type, 'certificateId' => $certificateId]]);
     return SignedCertificate::fromBinaryEncodedDer((string) $certificateDownloadResponse->getBody());
 }
コード例 #3
0
ファイル: PushCertificateTest.php プロジェクト: genkgo/push
 public function test()
 {
     $cert = new PushCertificate(new PrivateKey(), SignedCertificate::fromBinaryEncodedDer(file_get_contents(__DIR__ . '/../../Stubs/signed.certificate.cer')));
     $this->assertSame((string) $cert, (string) $cert->getSignedCertificate() . (string) $cert->getPrivateKey());
     $this->assertSame((string) $cert->getSignedCertificate() . (string) $cert->getPrivateKey(), (string) PushCertificate::fromString((string) $cert->getSignedCertificate() . (string) $cert->getPrivateKey()));
 }