openssl_spki_new

PHP 5 >= 5.6.0, PHP 7, PHP 8
openssl_spki_new - Generate a new signed public key and challenge
Manual
Code Examples

openssl_spki_new(
     OpenSSLAsymmetricKey$private_key,
     string$challenge,
     [int$digest_algo = OPENSSL_ALGO_MD5]
): string|false

Generates a signed public key and challenge using specified hashing algorithm

Parameters

private_key

private_key should be set to a private key that was previously generated by openssl_pkey_new (or otherwise obtained from the other openssl_pkey family of functions). The corresponding public portion of the key will be used to sign the CSR.

challenge

The challenge associated to associate with the SPKAC

digest_algo

The digest algorithm. See openssl_get_md_method().

Return Values

Returns a signed public key and challenge string or false on failure.

Exceptions and Errors

Emits an E_WARNING level error if an unknown signature algorithm is passed via the digest_algo parameter.

Changelog

Version Description
8.0.0 private_key accepts an OpenSSLAsymmetricKey instance now; previously, a resource of type OpenSSL key was accepted.

Related Functions

Example of openssl_spki_new

Show all examples for openssl_spki_new

PHP Version:


Function openssl_spki_new:

OpenSSL Functions

Most used PHP functions