Skip to content

Commit

Permalink
fix for mbstring func overload
Browse files Browse the repository at this point in the history
  • Loading branch information
Minishlink committed Feb 20, 2017
1 parent b9ce40d commit 16efaec
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,21 @@
"homepage": "https://github.com/Minishlink"
}
],
"repositories": [
{
"type": "vcs",
"url": "https://github.com/Minishlink/PHPASN1"
}
],
"require": {
"php": ">=5.6",
"mdanter/ecc": "^0.4.0",
"lib-openssl": "*",
"spomky-labs/base64url": "^1.0",
"spomky-labs/php-aes-gcm": "^1.2",
"spomky-labs/jose": "^6.0",
"guzzlehttp/guzzle": "^6.2"
"guzzlehttp/guzzle": "^6.2",
"fgrosse/phpasn1": "dev-fix_mbstring_overload as 1.5.2"
},
"require-dev": {
"phpunit/phpunit": "4.8.*"
Expand Down
2 changes: 1 addition & 1 deletion src/Encryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private static function hkdf($salt, $ikm, $info, $length)
$prk = hash_hmac('sha256', $ikm, $salt, true);

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

/**
Expand Down
2 changes: 1 addition & 1 deletion src/VAPID.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static function validate(array $vapid)
$posStartKey += 30; // length of '-----BEGIN EC PRIVATE KEY-----'

$pemSerializer = new PemPrivateKeySerializer(new DerPrivateKeySerializer());
$keys = self::getUncompressedKeys($pemSerializer->parse(substr($pem, $posStartKey, $posEndKey - $posStartKey)));
$keys = self::getUncompressedKeys($pemSerializer->parse(mb_substr($pem, $posStartKey, $posEndKey - $posStartKey, '8bit')));
$vapid['publicKey'] = $keys['publicKey'];
$vapid['privateKey'] = $keys['privateKey'];
}
Expand Down

0 comments on commit 16efaec

Please sign in to comment.