private function loadPEM($data)
{
$data = base64_decode(preg_replace('#-.*-|\\r|\\n#', '', $data));
$asnObject = Object::fromBinary($data);
Assertion::isInstanceOf($asnObject, Sequence::class);
$children = $asnObject->getChildren();
if (self::isPKCS8($children)) {
$children = self::loadPKCS8($children);
}
if (4 === count($children)) {
return $this->loadPrivatePEM($children);
} elseif (2 === count($children)) {
return $this->loadPublicPEM($children);
}
throw new \Exception('Unable to load the key');
}