Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 5932

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!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>List currently authorized publickeys</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.ssh2-publickey-init.html">ssh2_publickey_init</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.ssh2-publickey-remove.html">ssh2_publickey_remove</a></div>
 <div class="up"><a href="ref.ssh2.html">SSH2 Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.ssh2-publickey-list" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ssh2_publickey_list</h1>
  <p class="verinfo">(PECL ssh2 &gt;= 0.10)</p><p class="refpurpose"><span class="refname">ssh2_publickey_list</span> &mdash; <span class="dc-title">
   List currently authorized publickeys
  </span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.ssh2-publickey-list-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">array</span> <span class="methodname"><strong>ssh2_publickey_list</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$pkey</code></span>
   )</div>

  <p class="para rdfs-comment">
   List currently authorized publickeys.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.ssh2-publickey-list-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">pkey</code></em></span>
     <dd>

      <p class="para">
       Publickey Subsystem resource
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ssh2-publickey-list-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns a numerically indexed array of keys,
   each of which is an associative array containing:
   name, blob, and attrs elements.
  </p>
  <p class="para">
   <table class="doctable table">
    <caption><strong>Publickey elements</strong></caption>
    
     <thead>
      <tr>
       <th>Array Key</th>
       <th>Meaning</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>name</td>
       <td>Name of algorithm used by this publickey, for example:
       <em>ssh-dss</em> or <em>ssh-rsa</em>.</td>
      </tr>

      <tr>
       <td>blob</td>
       <td>Publickey blob as raw binary data.</td>
      </tr>

      <tr>
       <td>attrs</td>
       <td>Attributes assigned to this publickey. The most common
       attribute, and the only one supported by publickey version 1
       servers, is <em>comment</em>, which may be any freeform
       string.</td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.ssh2-publickey-list-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-4616">
    <p><strong>Example #1 Listing authorized keys with  <span class="function"><strong>ssh2_publickey_list()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$ssh2&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ssh2_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'shell.example.com'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">22</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">ssh2_auth_password</span><span style="color: #007700">(</span><span style="color: #0000BB">$ssh2</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'jdoe'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'secret'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$pkey&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ssh2_publickey_init</span><span style="color: #007700">(</span><span style="color: #0000BB">$ssh2</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$list&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ssh2_publickey_list</span><span style="color: #007700">(</span><span style="color: #0000BB">$pkey</span><span style="color: #007700">);<br /><br />foreach(</span><span style="color: #0000BB">$list&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">$key</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Key:&nbsp;</span><span style="color: #007700">{</span><span style="color: #0000BB">$key</span><span style="color: #007700">[</span><span style="color: #DD0000">'name'</span><span style="color: #007700">]}</span><span style="color: #DD0000">\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Blob:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">chunk_split</span><span style="color: #007700">(</span><span style="color: #0000BB">base64_encode</span><span style="color: #007700">(</span><span style="color: #0000BB">$key</span><span style="color: #007700">[</span><span style="color: #DD0000">'blob'</span><span style="color: #007700">]),&nbsp;</span><span style="color: #0000BB">40</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Comment:&nbsp;</span><span style="color: #007700">{</span><span style="color: #0000BB">$key</span><span style="color: #007700">[</span><span style="color: #DD0000">'attrs'</span><span style="color: #007700">][</span><span style="color: #DD0000">'comment'</span><span style="color: #007700">]}</span><span style="color: #DD0000">\n\n"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>The above example will output:</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Key: ssh-rsa
Blob: AAAAB3NzaC1yc2EAAAABIwAAAIEA5HVt6VqSGd5P
TrLRdjNONxXH1tVFGn0Bd26BF0aCP9qyJRlvdJ3j
4WBeX4ZmrveGrjMgkseSYc4xZ26sDHwfL351xjza
Lpipu\BGRrw17mWVBhuCExo476ri5tQFzbTc54VE
HYckxQ16CjSTibI5X69GmnYC9PNqEYq/1TP+HF10
Comment: John&#039;s Key

Key: ssh-rsa
Blob: AAAAB3NzaHVt6VqSGd5C1yc2EAAAABIwA232dnJA
AIEA5HVt6VqSGd5PTrLRdjNONxX/1TP+HF1HVt6V
qSGd50H1tVFGn0BB3NzaC1yc2EAd26BF0aCP9qyJ
RlvdJ3j4WBeX4ZmrveGrjMgkseSYc4xZ26HVt6Vq
SGd5sDHwfL351xjzaLpipu\BGB3NzaC1yc2EA/1T
Comment: Alice&#039;s Key

</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.ssh2-publickey-list-notes">
  <h3 class="title">Notes</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">The public key subsystem
is used for managing public keys on a server to which the client is
<em class="emphasis">already</em> authenticated.  To authenticate to a remote system
using public key authentication, use the
 <span class="function"><a href="function.ssh2-auth-pubkey-file.html" class="function">ssh2_auth_pubkey_file()</a></span> function instead.</span></p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.ssh2-publickey-list-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.ssh2-publickey-init.html" class="function" rel="rdfs-seeAlso">ssh2_publickey_init()</a> - Initialize Publickey subsystem</span></li>
    <li class="member"> <span class="function"><a href="function.ssh2-publickey-add.html" class="function" rel="rdfs-seeAlso">ssh2_publickey_add()</a> - Add an authorized publickey</span></li>
    <li class="member"> <span class="function"><a href="function.ssh2-publickey-remove.html" class="function" rel="rdfs-seeAlso">ssh2_publickey_remove()</a> - Remove an authorized publickey</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.ssh2-publickey-init.html">ssh2_publickey_init</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.ssh2-publickey-remove.html">ssh2_publickey_remove</a></div>
 <div class="up"><a href="ref.ssh2.html">SSH2 Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>