mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
tags in examples
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@120916 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
aeed73d9cf
commit
929d9c8a07
10 changed files with 30 additions and 12 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- splitted from ./en/functions/openssl.xml, last change in rev 1.19 -->
|
||||
<refentry id="function.openssl-csr-new">
|
||||
<refnamediv>
|
||||
|
@ -114,6 +114,7 @@
|
|||
self-signed-certificate</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Fill in data for the distinguished name to be used in the cert
|
||||
// You must change the values of these keys to match your name and
|
||||
// company, or more precisely, the name and company of the person/site
|
||||
|
@ -158,7 +159,7 @@ openssl_pkey_export($privkey, $pkeyout, "mypassword") and debug_zval_dump($pkeyo
|
|||
while (($e = openssl_error_string()) !== false) {
|
||||
echo $e . "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- splitted from ./en/functions/openssl.xml, last change in rev 1.19 -->
|
||||
<refentry id="function.openssl-csr-sign">
|
||||
<refnamediv>
|
||||
|
@ -40,6 +40,7 @@
|
|||
CSR (how to implement your own CA)</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Let's assume that this script is set to receive a CSR that has
|
||||
// been pasted into a textarea from another page
|
||||
$csrdata = $_POST["CSR"];
|
||||
|
@ -64,7 +65,7 @@ openssl_x509_export($usercert, $certout) and echo $certout;
|
|||
while (($e = openssl_error_string()) !== false) {
|
||||
echo $e . "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- splitted from ./en/functions/openssl.xml, last change in rev 1.4 -->
|
||||
<refentry id="function.openssl-error-string">
|
||||
<refnamediv>
|
||||
|
@ -26,9 +26,11 @@
|
|||
<title><function>openssl_error_string</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// lets assume you just called an openssl function that failed
|
||||
while($msg = openssl_error_string())
|
||||
echo $msg . "<br />\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- splitted from ./en/functions/openssl.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.openssl-open">
|
||||
<refnamediv>
|
||||
|
@ -34,6 +34,7 @@
|
|||
<title><function>openssl_open</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// $sealed and $env_key are assumed to contain the sealed data
|
||||
// and our envelope key, both given to us by the sealer.
|
||||
|
||||
|
@ -51,6 +52,7 @@ else
|
|||
|
||||
// free the private key from memory
|
||||
openssl_free_key($pkeyid);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- splitted from ./en/functions/openssl.xml, last change in rev 1.4 -->
|
||||
<refentry id="function.openssl-pkcs7-decrypt">
|
||||
<refnamediv>
|
||||
|
@ -29,6 +29,7 @@
|
|||
<title><function>openssl_pkcs7_decrypt</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// $cert and $key are assumed to contain your personal certificate and private
|
||||
// key pair, and that you are the recipient of an S/MIME message
|
||||
$infilename = "encrypted.msg"; // this file holds your encrypted message
|
||||
|
@ -38,6 +39,7 @@ if (openssl_pkcs7_decrypt($infilename, $outfilename, $cert, $key))
|
|||
echo "decrypted!";
|
||||
else
|
||||
echo "failed to decrypt!";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- splitted from ./en/functions/openssl.xml, last change in rev 1.4 -->
|
||||
<refentry id="function.openssl-pkcs7-encrypt">
|
||||
<refnamediv>
|
||||
|
@ -36,6 +36,7 @@
|
|||
<title><function>openssl_pkcs7_encrypt</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// the message you want to encrypt and send to your secret agent
|
||||
// in the field, known as nighthawk. You have his certificate
|
||||
// in the file nighthawk.pem
|
||||
|
@ -67,6 +68,7 @@ if (openssl_pkcs7_encrypt("msg.txt", "enc.txt", $key,
|
|||
// message encrypted - send it!
|
||||
exec(ini_get("sendmail_path") . " < enc.txt");
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- splitted from ./en/functions/openssl.xml, last change in rev 1.4 -->
|
||||
<refentry id="function.openssl-pkcs7-sign">
|
||||
<refnamediv>
|
||||
|
@ -45,6 +45,7 @@
|
|||
<title><function>openssl_pkcs7_sign</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// the message you want to sign so that recipient can be sure it was you that
|
||||
// sent it
|
||||
$data = <<<EOD
|
||||
|
@ -67,6 +68,7 @@ if (openssl_pkcs7_sign("msg.txt", "signed.txt", "mycert.pem",
|
|||
// message signed - send it!
|
||||
exec(ini_get("sendmail_path") . " < signed.txt");
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- splitted from ./en/functions/openssl.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.openssl-seal">
|
||||
<refnamediv>
|
||||
|
@ -38,6 +38,7 @@
|
|||
<title><function>openssl_seal</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// $data is assumed to contain the data to be sealed
|
||||
|
||||
// fetch public keys for our recipients, and ready them
|
||||
|
@ -58,6 +59,7 @@ openssl_seal($data, $sealed, $ekeys, array($pk1,$pk2));
|
|||
// free the keys from memory
|
||||
openssl_free_key($pk1);
|
||||
openssl_free_key($pk2);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<!-- splitted from ./en/functions/openssl.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.openssl-sign">
|
||||
<refnamediv>
|
||||
|
@ -32,6 +32,7 @@
|
|||
<title><function>openssl_sign</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// $data is assumed to contain the data to be signed
|
||||
|
||||
// fetch private key from file and ready it
|
||||
|
@ -45,6 +46,7 @@ openssl_sign($data, $signature, $pkeyid);
|
|||
|
||||
// free the key from memory
|
||||
openssl_free_key($pkeyid);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<!-- splitted from ./en/functions/openssl.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.openssl-verify">
|
||||
<refnamediv>
|
||||
|
@ -32,6 +32,7 @@
|
|||
<title><function>openssl_verify</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// $data and $signature are assumed to contain the data and the signature
|
||||
|
||||
// fetch public key from certificate and ready it
|
||||
|
@ -51,6 +52,7 @@ else
|
|||
|
||||
// free the key from memory
|
||||
openssl_free_key($pubkeyid);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
|
Loading…
Reference in a new issue