OPENSSL_GET_CERT_LOCATIONS(3) 1 OPENSSL_GET_CERT_LOCATIONS(3)openssl_get_cert_locations - Retrieve the available certificate locationsSYNOPSIS
array openssl_get_cert_locations (void )
DESCRIPTION openssl_get_cert_locations(3) returns an array with information about the available certificate locations that will be searched for SSL
certificates.
PARAMETERS
This function has no parameters.
RETURN VALUES
Returns an array with the available certificate locations.
EXAMPLES
Example #1
openssl_get_cert_locations(3) example
<?php
var_dump(openssl_get_cert_locations());
?>
The above example will output:
array(8) {
["default_cert_file"]=>
string(21) "/usr/lib/ssl/cert.pem"
["default_cert_file_env"]=>
string(13) "SSL_CERT_FILE"
["default_cert_dir"]=>
string(18) "/usr/lib/ssl/certs"
["default_cert_dir_env"]=>
string(12) "SSL_CERT_DIR"
["default_private_dir"]=>
string(20) "/usr/lib/ssl/private"
["default_default_cert_area"]=>
string(12) "/usr/lib/ssl"
["ini_cafile"]=>
string(0) ""
["ini_capath"]=>
string(0) ""
}
PHP Documentation Group OPENSSL_GET_CERT_LOCATIONS(3)
Check Out this Related Man Page
OPENSSL_PKCS7_SIGN(3) 1 OPENSSL_PKCS7_SIGN(3)openssl_pkcs7_sign - Sign an S/MIME message
SYNOPSIS
bool openssl_pkcs7_sign (string $infilename, string $outfilename, mixed $signcert, mixed $privkey, array $headers, [int $flags =
PKCS7_DETACHED], [string $extracerts])
DESCRIPTION openssl_pkcs7_sign(3) takes the contents of the file named $infilename and signs them using the certificate and its matching private key
specified by $signcert and $privkey parameters.
PARAMETERS
o $infilename
-
o $outfilename
-
o $signcert
-
o $privkey
-
o $headers
-$headers is an array of headers that will be prepended to the data after it has been signed (see openssl_pkcs7_encrypt(3) for
more information about the format of this parameter).
o $flags
-$flags can be used to alter the output - see PKCS7 constants.
o $extracerts
-$extracerts specifies the name of a file containing a bunch of extra certificates to include in the signature which can for exam-
ple be used to help the recipient to verify the certificate that you used.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
openssl_pkcs7_sign(3) example
<?php
// the message you want to sign so that recipient can be sure it was you that
// sent it
$data = <<<EOD
You have my authorization to spend $10,000 on dinner expenses.
The CEO
EOD;
// save message to file
$fp = fopen("msg.txt", "w");
fwrite($fp, $data);
fclose($fp);
// encrypt it
if (openssl_pkcs7_sign("msg.txt", "signed.txt", "mycert.pem",
array("file://mycert.pem", "mypassphrase"),
array("To" => "joes@example.com", // keyed syntax
"From: HQ <ceo@example.com>", // indexed syntax
"Subject" => "Eyes only")
)) {
// message signed - send it!
exec(ini_get("sendmail_path") . " < signed.txt");
}
?>
PHP Documentation Group OPENSSL_PKCS7_SIGN(3)