openssl_pkey_get_details

Supported Versions: PHP 5 >= 5.2.0, PHP 7, PHP 8
Returns an array with the key details
<?php openssl_pkey_get_details(OpenSSLAsymmetricKey $key): array|false
<?php         if ($pubkey === false) {

            throw new \RuntimeException('Failed to retrieve the public key from certificate');

        }

        $pubkeydetails = openssl_pkey_get_details($pubkey);

        $pubkeypem = $pubkeydetails['key'];


        $start = '-----BEGIN PUBLIC KEY-----';
<?php         $info = openssl_x509_parse($h, false);



        $pin = openssl_pkey_get_public($h);

        $pin = openssl_pkey_get_details($pin)['key'];

        $pin = \array_slice(explode("\n", $pin), 1, -2);

        $pin = base64_decode(implode('', $pin));

        $pin = base64_encode(hash('sha256', $pin, true));