<?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.ssh2-publickey-add"> <refnamediv> <refname>ssh2_publickey_add</refname> <refpurpose> Add an authorized publickey </refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>ssh2_publickey_add</methodname> <methodparam><type>resource</type><parameter>pkey</parameter></methodparam> <methodparam><type>string</type><parameter>algoname</parameter></methodparam> <methodparam><type>string</type><parameter>blob</parameter></methodparam> <methodparam choice="opt"><type>bool</type><parameter>overwrite</parameter><initializer>false</initializer></methodparam> <methodparam choice="opt"><type>array</type><parameter>attributes</parameter></methodparam> </methodsynopsis> ¬e.ssh2.subsystem.publickey; </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>pkey</parameter></term> <listitem> <para> Publickey Subsystem resource created by <function>ssh2_publickey_init</function>. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>algoname</parameter></term> <listitem> <para> Publickey algorithm (e.g.): ssh-dss, ssh-rsa </para> </listitem> </varlistentry> <varlistentry> <term><parameter>blob</parameter></term> <listitem> <para> Publickey blob as raw binary data </para> </listitem> </varlistentry> <varlistentry> <term><parameter>overwrite</parameter></term> <listitem> <para> If the specified key already exists, should it be overwritten? </para> </listitem> </varlistentry> <varlistentry> <term><parameter>attributes</parameter></term> <listitem> <para> Associative array of attributes to assign to this public key. Refer to ietf-secsh-publickey-subsystem for a list of supported attributes. To mark an attribute as mandatory, precede its name with an asterisk. If the server is unable to support an attribute marked mandatory, it will abort the add process. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &return.success; </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>Adding a publickey with <function>ssh2_publickey_add</function></title> <programlisting role="php"> <![CDATA[ <?php $ssh2 = ssh2_connect('shell.example.com', 22); ssh2_auth_password($ssh2, 'jdoe', 'password'); $pkey = ssh2_publickey_init($ssh2); $keyblob = base64_decode(' AAAAB3NzaC1yc2EAAAABIwAAAIEA5HVt6VqSGd5PTrLRdjNONxXH1tVFGn0 Bd26BF0aCP9qyJRlvdJ3j4WBeX4ZmrveGrjMgkseSYc4xZ26sDHwfL351xj zaLpipu\BGRrw17mWVBhuCExo476ri5tQFzbTc54VEHYckxQ16CjSTibI5X 69GmnYC9PNqEYq/1TP+HF10='); ssh2_publickey_add($pkey, 'ssh-rsa', $keyblob, false, array('comment'=>"John's Key")); ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>ssh2_publickey_init</function></member> <member><function>ssh2_publickey_remove</function></member> <member><function>ssh2_publickey_list</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:"~/.phpdoc/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 -->