<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Key/Certificate parameters</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="openssl.constsni.html">Server Name Indication constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="openssl.cert.verification.html">Certificate Verification</a></div> <div class="up"><a href="book.openssl.html">OpenSSL</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="openssl.certparams" class="appendix"> <h1>Key/Certificate parameters</h1> <p class="para"> Quite a few of the openssl functions require a key or a certificate parameter. PHP 4.0.5 and earlier have to use a key or certificate <span class="type"><a href="language.types.resource.html" class="type resource">resource</a></span> returned by one of the <em>openssl_get_xxx()</em> functions. Later versions may use one of the following methods: <ul class="itemizedlist"> <li class="listitem"> <p class="para"> Certificates <ol type="1"> <li class="listitem"> <span class="simpara"> An X.509 resource returned from <span class="function"><a href="function.openssl-x509-read.html" class="function">openssl_x509_read()</a></span> </span> </li> <li class="listitem"> <span class="simpara">A string having the format <var class="filename">file://path/to/cert.pem</var>; the named file must contain a PEM encoded certificate </span> </li> <li class="listitem"> <span class="simpara"> A string containing the content of a certificate, PEM encoded </span> </li> </ol> </p> </li> <li class="listitem"> <p class="para"> Public/Private Keys <ol type="1"> <li class="listitem"> <span class="simpara">A key resource returned from <span class="function"><a href="function.openssl-get-publickey.html" class="function">openssl_get_publickey()</a></span> or <span class="function"><a href="function.openssl-get-privatekey.html" class="function">openssl_get_privatekey()</a></span> </span> </li> <li class="listitem"> <span class="simpara">For public keys only: an X.509 resource</span> </li> <li class="listitem"> <span class="simpara">A string having the format <var class="filename">file://path/to/file.pem</var> - the named file must contain a PEM encoded certificate/private key (it may contain both) </span> </li> <li class="listitem"> <span class="simpara"> A string containing the content of a certificate/key, PEM encoded </span> </li> <li class="listitem"> <span class="simpara"> For private keys, you may also use the syntax <em>array($key, $passphrase)</em> where <var class="varname"><var class="varname">$key</var></var> represents a key specified using the file:// or textual content notation above, and <var class="varname"><var class="varname">$passphrase</var></var> represents a string containing the passphrase for that private key </span> </li> </ol> </p> </li> </ul> </p> </div> <hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="openssl.constsni.html">Server Name Indication constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="openssl.cert.verification.html">Certificate Verification</a></div> <div class="up"><a href="book.openssl.html">OpenSSL</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>