private function loadPEM($data)
{
$res = openssl_pkey_get_private($data);
if (false === $res) {
$res = openssl_pkey_get_public($data);
}
Assertion::false(false === $res, 'Unable to load the key');
$details = openssl_pkey_get_details($res);
Assertion::keyExists($details, 'rsa', 'Unable to load the key');
$this->values['kty'] = 'RSA';
$keys = ['n' => 'n', 'e' => 'e', 'd' => 'd', 'p' => 'p', 'q' => 'q', 'dp' => 'dmp1', 'dq' => 'dmq1', 'qi' => 'iqmp'];
foreach ($details['rsa'] as $key => $value) {
if (in_array($key, $keys)) {
$value = Base64Url::encode($value);
$this->values[array_search($key, $keys)] = $value;
}
}
}