Skip to content

Commit 16efaec

Browse files
committed
fix for mbstring func overload
1 parent b9ce40d commit 16efaec

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

composer.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,21 @@
1212
"homepage": "https://github.com/Minishlink"
1313
}
1414
],
15+
"repositories": [
16+
{
17+
"type": "vcs",
18+
"url": "https://github.com/Minishlink/PHPASN1"
19+
}
20+
],
1521
"require": {
1622
"php": ">=5.6",
1723
"mdanter/ecc": "^0.4.0",
1824
"lib-openssl": "*",
1925
"spomky-labs/base64url": "^1.0",
2026
"spomky-labs/php-aes-gcm": "^1.2",
2127
"spomky-labs/jose": "^6.0",
22-
"guzzlehttp/guzzle": "^6.2"
28+
"guzzlehttp/guzzle": "^6.2",
29+
"fgrosse/phpasn1": "dev-fix_mbstring_overload as 1.5.2"
2330
},
2431
"require-dev": {
2532
"phpunit/phpunit": "4.8.*"

src/Encryption.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ private static function hkdf($salt, $ikm, $info, $length)
121121
$prk = hash_hmac('sha256', $ikm, $salt, true);
122122

123123
// expand
124-
return substr(hash_hmac('sha256', $info.chr(1), $prk, true), 0, $length);
124+
return mb_substr(hash_hmac('sha256', $info.chr(1), $prk, true), 0, $length, '8bit');
125125
}
126126

127127
/**

src/VAPID.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static function validate(array $vapid)
5858
$posStartKey += 30; // length of '-----BEGIN EC PRIVATE KEY-----'
5959

6060
$pemSerializer = new PemPrivateKeySerializer(new DerPrivateKeySerializer());
61-
$keys = self::getUncompressedKeys($pemSerializer->parse(substr($pem, $posStartKey, $posEndKey - $posStartKey)));
61+
$keys = self::getUncompressedKeys($pemSerializer->parse(mb_substr($pem, $posStartKey, $posEndKey - $posStartKey, '8bit')));
6262
$vapid['publicKey'] = $keys['publicKey'];
6363
$vapid['privateKey'] = $keys['privateKey'];
6464
}

0 commit comments

Comments
 (0)