public function toPEM()
{
$result = '-----BEGIN ' . ($this->isPrivate() ? 'RSA PRIVATE' : 'PUBLIC') . ' KEY-----' . PHP_EOL;
$result .= chunk_split(base64_encode($this->getBinary()), 64, PHP_EOL);
$result .= '-----END ' . ($this->isPrivate() ? 'RSA PRIVATE' : 'PUBLIC') . ' KEY-----' . PHP_EOL;
return $result;
}