private function extractPemContent(&$pem)
    {
        // Check PEM passed
        if (!$pem) {
            throw new YotiClientException('PEM file is required', 400);
        }

        // Check that file exists if user passed PEM as a local file path
        if (strpos($pem, 'file://') !== false && !file_exists($pem)) {
            throw new YotiClientException('PEM file was not found.', 400);
        }

        // If file exists grab the content
        if (file_exists($pem)) {
            $pem = file_get_contents($pem);
        }

        // Check if key is valid
        if (!openssl_get_privatekey($pem)) {
            throw new YotiClientException('PEM key content is invalid', 400);
        }
    }