Skip to content

Commit 6c72178

Browse files
committed
Merge uo 3.4.4 to 4.0.x
1 parent b5ba7f9 commit 6c72178

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/Library/KeyManagement/KeyConverter/KeyConverter.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,9 @@ public static function loadFromX5C(array $x5c): array
162162
throw new InvalidArgumentException('The certificate chain is empty');
163163
}
164164
foreach ($x5c as $id => $cert) {
165+
assert(is_string($cert), 'Invalid certificate chain');
165166
$x5c[$id] = '-----BEGIN CERTIFICATE-----' . "\n" . chunk_split(
166-
(string) $cert,
167+
$cert,
167168
64,
168169
"\n"
169170
) . '-----END CERTIFICATE-----';
@@ -180,6 +181,9 @@ public static function loadFromX5C(array $x5c): array
180181
return self::loadKeyFromCertificate(reset($x5c));
181182
}
182183

184+
/**
185+
* @return array<array-key, mixed>
186+
*/
183187
private static function loadKeyFromDER(string $der, ?string $password = null): array
184188
{
185189
$pem = self::convertDerToPem($der);

src/Library/KeyManagement/X5UFactory.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ public function loadFromUrl(string $url, array $header = []): JWKSet
3030

3131
$keys = [];
3232
foreach ($data as $kid => $cert) {
33-
if (mb_strpos((string) $cert, '-----BEGIN CERTIFICATE-----') === false) {
33+
assert(is_string($cert), 'Invalid content.');
34+
if (mb_strpos($cert, '-----BEGIN CERTIFICATE-----') === false) {
3435
$cert = '-----BEGIN CERTIFICATE-----' . "\n" . $cert . "\n" . '-----END CERTIFICATE-----';
3536
}
3637
$jwk = KeyConverter::loadKeyFromCertificate($cert);

0 commit comments

Comments
 (0)