php-doc-en/reference/ssh2/functions/ssh2-publickey-list.xml

163 lines
3.9 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.ssh2-publickey-list">
<refnamediv>
<refname>ssh2_publickey_list</refname>
<refpurpose>
List currently authorized publickeys
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>ssh2_publickey_list</methodname>
<methodparam><type>resource</type><parameter>pkey</parameter></methodparam>
</methodsynopsis>
<para>
List currently authorized publickeys.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>pkey</parameter></term>
<listitem>
<para>
Publickey Subsystem resource
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a numerically indexed array of keys,
each of which is an associative array containing:
name, blob, and attrs elements.
</para>
<para>
<table>
<title>Publickey elements</title>
<tgroup cols="2">
<thead>
<row>
<entry>Array Key</entry>
<entry>Meaning</entry>
</row>
</thead>
<tbody>
<row>
<entry>name</entry>
<entry>Name of algorithm used by this publickey, for example:
<literal>ssh-dss</literal> or <literal>ssh-rsa</literal>.</entry>
</row>
<row>
<entry>blob</entry>
<entry>Publickey blob as raw binary data.</entry>
</row>
<row>
<entry>attrs</entry>
<entry>Attributes assigned to this publickey. The most common
attribute, and the only one supported by publickey version 1
servers, is <literal>comment</literal>, which may be any freeform
string.</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Listing authorized keys with <function>ssh2_publickey_list</function></title>
<programlisting role="php">
<![CDATA[
<?php
$ssh2 = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($ssh2, 'jdoe', 'secret');
$pkey = ssh2_publickey_init($ssh2);
$list = ssh2_publickey_list($pkey);
foreach($list as $key) {
echo "Key: {$key['name']}\n";
echo "Blob: " . chunk_split(base64_encode($key['blob']), 40, "\n") . "\n";
echo "Comment: {$key['attrs']['comment']}\n\n";
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Key: ssh-rsa
Blob: AAAAB3NzaC1yc2EAAAABIwAAAIEA5HVt6VqSGd5P
TrLRdjNONxXH1tVFGn0Bd26BF0aCP9qyJRlvdJ3j
4WBeX4ZmrveGrjMgkseSYc4xZ26sDHwfL351xjza
Lpipu\BGRrw17mWVBhuCExo476ri5tQFzbTc54VE
HYckxQ16CjSTibI5X69GmnYC9PNqEYq/1TP+HF10
Comment: John's Key
Key: ssh-rsa
Blob: AAAAB3NzaHVt6VqSGd5C1yc2EAAAABIwA232dnJA
AIEA5HVt6VqSGd5PTrLRdjNONxX/1TP+HF1HVt6V
qSGd50H1tVFGn0BB3NzaC1yc2EAd26BF0aCP9qyJ
RlvdJ3j4WBeX4ZmrveGrjMgkseSYc4xZ26HVt6Vq
SGd5sDHwfL351xjzaLpipu\BGB3NzaC1yc2EA/1T
Comment: Alice's Key
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
&note.ssh2.subsystem.publickey;
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>ssh2_publickey_init</function></member>
<member><function>ssh2_publickey_add</function></member>
<member><function>ssh2_publickey_remove</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->