phpseclib\Crypt\RSA\PKCS8::load PHP Method

load() static public method

Break a public or private key down into its constituent components
static public load ( string $key, string $password = '' ) : array
$key string
$password string optional
return array
    static function load($key, $password = '')
    {
        $components = ['isPublicKey' => strpos($key, 'PUBLIC') !== false];
        $key = parent::load($key, $password);
        if ($key === false) {
            return false;
        }
        $type = isset($key['privateKey']) ? 'private' : 'public';
        if ($key[$type . 'KeyAlgorithm']['algorithm'] != '1.2.840.113549.1.1.1') {
            return false;
        }
        $result = $components + PKCS1::load($key[$type . 'Key']);
        if (isset($key['meta'])) {
            $result['meta'] = $key['meta'];
        }
        return $result;
    }