mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-11-27 01:02:12 +05:30
Also accept an RSA key with crlf
This commit is contained in:
parent
cc98b5ec16
commit
4563685375
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -11,3 +11,5 @@
|
|||||||
/CHANGELOG.md export-ignore
|
/CHANGELOG.md export-ignore
|
||||||
/CONTRIBUTING.md export-ignore
|
/CONTRIBUTING.md export-ignore
|
||||||
/README.md export-ignore
|
/README.md export-ignore
|
||||||
|
|
||||||
|
+*.crlf eol=crlf
|
||||||
|
@ -14,7 +14,7 @@ namespace League\OAuth2\Server;
|
|||||||
class CryptKey
|
class CryptKey
|
||||||
{
|
{
|
||||||
const RSA_KEY_PATTERN =
|
const RSA_KEY_PATTERN =
|
||||||
'/^(-----BEGIN (RSA )?(PUBLIC|PRIVATE) KEY-----\n)(.|\n)+(-----END (RSA )?(PUBLIC|PRIVATE) KEY-----)$/';
|
'/^(-----BEGIN (RSA )?(PUBLIC|PRIVATE) KEY-----)(.|\n|\r)+(-----END (RSA )?(PUBLIC|PRIVATE) KEY-----)$/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
|
@ -21,6 +21,12 @@ class CryptKeyTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$this->assertEquals('file://' . $keyFile, $key->getKeyPath());
|
$this->assertEquals('file://' . $keyFile, $key->getKeyPath());
|
||||||
$this->assertEquals('secret', $key->getPassPhrase());
|
$this->assertEquals('secret', $key->getPassPhrase());
|
||||||
|
|
||||||
|
$keyFile = __DIR__ . '/Stubs/public.key.crlf';
|
||||||
|
$key = new CryptKey($keyFile, 'secret');
|
||||||
|
|
||||||
|
$this->assertEquals('file://' . $keyFile, $key->getKeyPath());
|
||||||
|
$this->assertEquals('secret', $key->getPassPhrase());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testKeyFileCreation()
|
public function testKeyFileCreation()
|
||||||
|
6
tests/Stubs/public.key.crlf
Normal file
6
tests/Stubs/public.key.crlf
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
-----BEGIN PUBLIC KEY-----
|
||||||
|
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDOBcFjGUlo3BJ9zjwQLgAHn6Oy
|
||||||
|
5Si0uB7MublTiPob8rWTiCE4weAFqzPoAB07vB0t0f8c1R8rmwHMD5ljWPBgJ8Fe
|
||||||
|
wtwAUzprOBcau6DWukd/TKxXWeVLAl/NZxijI+jR5QDBYLNBtj1G4LBVHMmINd3r
|
||||||
|
yCycbf9ac3rcC8zhrQIDAQAB
|
||||||
|
-----END PUBLIC KEY-----
|
Loading…
Reference in New Issue
Block a user