<?php $curve = "prime256v1"; // ECDSA curve // Generate the key pair $keyPair = openssl_pkey_new(array( 'private_key_type' => OPENSSL_KEYTYPE_EC, 'curve_name' => $curve, )); // Extract the private key openssl_pkey_export($keyPair, $privateKey); // Extract the public key $publicKey = openssl_pkey_get_details($keyPair)['key']; // Display the key pair echo "Private Key: " . PHP_EOL . $privateKey . PHP_EOL; echo "Public Key: " . PHP_EOL . $publicKey . PHP_EOL; ?>