Skip to content

RFC: Add support for ES256 algorithm#256

Merged
bshaffer merged 10 commits intomasterfrom
add-ec256
Feb 24, 2020
Merged

RFC: Add support for ES256 algorithm#256
bshaffer merged 10 commits intomasterfrom
add-ec256

Conversation

@bshaffer
Copy link
Copy Markdown
Collaborator

@bshaffer bshaffer commented Nov 5, 2019

Allows verification of EC256 algorithm (see #251).

example:

$http = new GuzzleHttp\Client();
$response = $http->request('GET', 'https://www.gstatic.com/iap/verify/public_key', []);

// Create an array of keys from the gstatic URL
$keys = json_decode((string) $response->getBody(), true);

// Validate the signature using the key set and ES256 algorithm.
try {
    $jwt = FirebaseJWT::decode($jwt, $keys, ['ES256']);
} catch (\Exception $e) {
    return print("Failed to validate JWT: " . $e->getMessage() . PHP_EOL);
}

// Token contains issuer, audience, etc.
assert($jwt->iss == 'https://cloud.google.com/iap');
assert($jwt->aud == $expected_audience);

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 5, 2019
@bshaffer bshaffer changed the title RFC: Add support for EC256 algorithm RFC: Add support for ES256 algorithm Feb 12, 2020
@bshaffer bshaffer requested a review from jdpedrie February 19, 2020 18:04
@bshaffer
Copy link
Copy Markdown
Collaborator Author

Actually implements support for #239

@bshaffer bshaffer requested a review from dwsupplee February 20, 2020 18:45
@bshaffer bshaffer merged commit 4566062 into master Feb 24, 2020
@bshaffer bshaffer deleted the add-ec256 branch February 24, 2020 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants