Skip to content

Commit

Permalink
X5U Certification Loading
Browse files Browse the repository at this point in the history
This commit fixes a bug when the X5U certificates already have the BEGIN and END statements.
  • Loading branch information
Spomky committed Jan 4, 2018
1 parent a1b60e8 commit 5237fe4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Component/KeyManagement/X5UFactory.php
Expand Up @@ -58,7 +58,9 @@ public function loadFromUrl(string $url, array $header = []): JWKSet

$keys = [];
foreach ($data as $kid => $cert) {
$cert = '-----BEGIN CERTIFICATE-----'.PHP_EOL.$cert.PHP_EOL.'-----END CERTIFICATE-----';
if (false === strpos($cert, '-----BEGIN CERTIFICATE-----')) {
$cert = '-----BEGIN CERTIFICATE-----'.PHP_EOL.$cert.PHP_EOL.'-----END CERTIFICATE-----';
}
$jwk = KeyConverter::loadKeyFromCertificate($cert);
if (is_string($kid)) {
$jwk['kid'] = $kid;
Expand Down

0 comments on commit 5237fe4

Please sign in to comment.