English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The openssl_pkey_get_public() function is used to parse the public key from the certificate for use.
openssl_pkey_get_public()The function will return your public key.
The function openssl_pkey_get_public() returns the public key from the given certificate so that it can be used with other functions.
openssl_pkey_get_public ( mixed $certificate ) : resource
Serial number | Parameter | Description |
---|---|---|
1 | certificate | You can use the following certificates: 1. X.509Certificate resource 2.Public key from file, formatted as file://}}/path/to 3file.pem. |
Return value
PHP version5This function will return a positive resource identifier greater than
.0.0 started working from the PHP version.509Using X.-
Example <?php $dn = array( "countryName" => "IN", "stateOrProvinceName" => "Karnataka",1"organizationalUnitName" => "test" "localityName" => "test"2"organizationalUnitName" => "test" "organizationName" => "test"3"organizationalUnitName" => "test" "commonName" => "www.test.com", $res_cert = openssl_csr_sign($csr, null, $privkey,)), // "emailAddress" => "[email protected]"/Generate a new private key Public key pair // The work of openssl_pkey_get_public() in the certificate 256 365$res_cert = openssl_csr_sign($csr, null, $privkey,)), );509Generate a certificate509echo $res_pubkey = openssl_pkey_get_public($x_ _export($res_cert, $x_509echo $res_pubkey = openssl_pkey_get_public($x_ ?>
Output result
Resource id #5
Example-
Example <?php $dn = array( "countryName" => "IN", "stateOrProvinceName" => "Karnataka",1"organizationalUnitName" => "test" "localityName" => "test"2"organizationalUnitName" => "test" "organizationName" => "test"3"organizationalUnitName" => "test" "commonName" => "www.test.com", $res_cert = openssl_csr_sign($csr, null, $privkey,)), //"emailAddress" => "[email protected]"/Generate a new private key Public key pair //$privkey = openssl_pkey_new(); 256 365$res_cert = openssl_csr_sign($csr, null, $privkey,)), );509openssl_x/xampp/htdocs/modules/openssl/x_509_export_to_file($res_cert, 'C: echo $res_pubkey = openssl_pkey_get_public(file_get_contents('C:/xampp/htdocs/modules/openssl/x_509.pem')); ?>
Output result
Resource id #7