PHP openssl_spki_export_challenge() Function Last Updated : 13 Sep, 2020 Comments Improve Suggest changes Like Article Like Report The openssl_spki_export_challenge() function is an inbuilt function in PHP and is used to export the signed public key and the challenge associated with it. It verifies a signed public key and challenge. Syntax: string openssl_spki_export_challenge( string &$spkac ) Parameters: This function accepts single parameter as mentioned above and described below: $spkac: This parameter is a format for sending a Certification Signing Request which encodes a public key that can be manipulated using openssl. Return Values: This function returns the associated challenge string or NULL on failure. Errors/Exceptions: If an invalid argument is passed using the "spkac" parameter, the E_WARNING level emits an error. Below program illustrate the openssl_spki_export_challenge() function in PHP: Program: PHP <?php $pkey = openssl_pkey_new(array("spki")); $inputChallengeString = "geeks"; // Generate a new key pair using // "geeksforgeeks" as challenge string $spkac = openssl_spki_new( $pkey, $inputChallengeString); // Extract challenge key from key $extractedChallengeString = openssl_spki_export_challenge( preg_replace('/SPKAC=/', '', $spkac)); //if challenge string is not null if (! is_null($extractedChallengeString)) { echo "Used challenge string is:" . $inputChallengeString."\n"; // print challenge key echo "Extracted challenge string is:" . $extractedChallengeString . "\n"; } ?> Output: Used challenge string is:geeks Extracted challenge string is:geeks Reference: https://www.php.net/manual/en/function.openssl-spki-export-challenge.php Comment More infoAdvertise with us Next Article PHP openssl_error_string() Function S shubham_singh Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP openssl_pkey_export() Function The openssl_pkey_export() function is an inbuilt function in PHP which is used to view and manage private keys and public keys. It gets an exportable representation of a key into a string. It exports the key as a PEM encoded string and stores to pass by reference. Syntax: bool openssl_pkey_export( m 2 min read PHP openssl_pkcs12_export() Function The opensl_pkcs12_export() function is a built-in function in PHP which is used to store in a string called x509 in a PKCS # 12 file format. Certificate store file corresponding to PKCS # 12 variable. Syntax: bool openssl_pkcs12_export( mixed $x509, string &$out, mixed $priv_key, string $pass [, 2 min read PHP openssl_error_string() Function The openssl_error_string() function is an inbuilt function in PHP which is used to get  the last error from the openSSL library. Error messages are queued, so this function should be called multiple times to collect all of the information. The last error will be the most recent one. Syntax: openssl_ 3 min read PHP openssl_pkcs12_export_to_file() Function The openssl_pkcs12_export_to_file() function is an inbuilt function in PHP which is used to store x509 into a file named by filename in a PKCS#12 file format. PKCS12 is Public-Key Cryptography Standards which defines an archive-file format for storing server certificates. Syntax: bool openssl_pkcs12 6 min read PHP openssl_digest() Function The openssl_digest() function is an inbuilt function in PHP that is used to compute a digest hash value for the given data using a given method and returns a raw or binary hex-encoded string. Syntax: openssl_digest( string $data, string $digest_algo, bool $binary = false): string|false Parameters: T 2 min read PHP openssl_spki_verify() Function The openssl_spki_verify() function is a built-in function in PHP and is used to validate the supplied signed public key and challenge. This should be the public key corresponding to the private key used for the signature. It verifies a signed public key and challenge. Syntax: string openssl_spki_ver 2 min read Like