public static function generatePemFile(
        $pem_file,
        $pem_passphrase,
        $country_name,
        $state_or_province_name,
        $locality_name,
        $organization_name,
        $organizational_unit_name,
        $common_name,
        $email_address
    ): void {
        // Generate PEM file
        $dn = [
            'countryName' => $country_name,
            'stateOrProvinceName' => $state_or_province_name,
            'localityName' => $locality_name,
            'organizationName' => $organization_name,
            'organizationalUnitName' => $organizational_unit_name,
            'commonName' => $common_name,
            'emailAddress' => $email_address,
        ];

        $privkey = openssl_pkey_new();
        $cert = openssl_csr_new($dn, $privkey);
        $cert = openssl_csr_sign($cert, null, $privkey, 365);

        $pem = [];

        openssl_x509_export($cert, $pem[0]);
        openssl_pkey_export($privkey, $pem[1], $pem_passphrase);

        $pem = implode($pem);
        file_put_contents($pem_file, $pem);
    }