php-doc-en/reference/openssl/functions/openssl-pkey-get-details.xml
2017-11-03 21:02:16 +00:00

237 lines
6.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.openssl-pkey-get-details">
<refnamediv>
<refname>openssl_pkey_get_details</refname>
<refpurpose>Returns an array with the key details</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>openssl_pkey_get_details</methodname>
<methodparam><type>resource</type><parameter>key</parameter></methodparam>
</methodsynopsis>
<para>
This function returns the key details (bits, key, type).
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
Resource holding the key.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an array with the key details in success or &false; in failure.
Returned array has indexes <literal>bits</literal> (number of bits),
<literal>key</literal> (string representation of the public key) and
<literal>type</literal> (type of the key which is one of
<constant>OPENSSL_KEYTYPE_RSA</constant>,
<constant>OPENSSL_KEYTYPE_DSA</constant>,
<constant>OPENSSL_KEYTYPE_DH</constant>,
<constant>OPENSSL_KEYTYPE_EC</constant> or -1 meaning unknown).
</para>
<para>
Depending on the key type used, additional details may be returned. Note that
some elements may not always be available.
</para>
<itemizedlist>
<listitem>
<simpara>
<constant>OPENSSL_KEYTYPE_RSA</constant>, an additional array key named <literal>"rsa"</literal>,
containing the key data is returned.
</simpara>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>Key</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>"n"</literal></entry>
<entry>modulus</entry>
</row>
<row>
<entry><literal>"e"</literal></entry>
<entry>public exponent</entry>
</row>
<row>
<entry><literal>"d"</literal></entry>
<entry>private exponent</entry>
</row>
<row>
<entry><literal>"p"</literal></entry>
<entry>prime 1</entry>
</row>
<row>
<entry><literal>"q"</literal></entry>
<entry>prime 2</entry>
</row>
<row>
<entry><literal>"dmp1"</literal></entry>
<entry>exponent1, d mod (p-1)</entry>
</row>
<row>
<entry><literal>"dmq1"</literal></entry>
<entry>exponent2, d mod (q-1)</entry>
</row>
<row>
<entry><literal>"iqmp"</literal></entry>
<entry>coefficient, (inverse of q) mod p</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</listitem>
<listitem>
<simpara>
<constant>OPENSSL_KEYTYPE_DSA</constant>, an additional array key named <literal>"dsa"</literal>,
containing the key data is returned.
</simpara>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>Key</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>"p"</literal></entry>
<entry>prime number (public)</entry>
</row>
<row>
<entry><literal>"q"</literal></entry>
<entry>160-bit subprime, q | p-1 (public)</entry>
</row>
<row>
<entry><literal>"g"</literal></entry>
<entry>generator of subgroup (public)</entry>
</row>
<row>
<entry><literal>"priv_key"</literal></entry>
<entry>private key x</entry>
</row>
<row>
<entry><literal>"pub_key"</literal></entry>
<entry>public key y = g^x</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</listitem>
<listitem>
<simpara>
<constant>OPENSSL_KEYTYPE_DH</constant>, an additional array key named <literal>"dh"</literal>,
containing the key data is returned.
</simpara>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>Key</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>"p"</literal></entry>
<entry>prime number (shared)</entry>
</row>
<row>
<entry><literal>"g"</literal></entry>
<entry>generator of Z_p (shared)</entry>
</row>
<row>
<entry><literal>"priv_key"</literal></entry>
<entry>private DH value x</entry>
</row>
<row>
<entry><literal>"pub_key"</literal></entry>
<entry>public DH value g^x</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</listitem>
<listitem>
<simpara>
<constant>OPENSSL_KEYTYPE_EC</constant>, an additional array key named <literal>"ec"</literal>,
containing the key data is returned.
</simpara>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>Key</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>"curve_name"</literal></entry>
<entry>name of curve, see <function>openssl_get_curve_names</function></entry>
</row>
<row>
<entry><literal>"curve_oid"</literal></entry>
<entry>ASN1 Object identifier (OID) for EC curve.</entry>
</row>
<row>
<entry><literal>"x"</literal></entry>
<entry>x coordinate (public)</entry>
</row>
<row>
<entry><literal>"y"</literal></entry>
<entry>y coordinate (public)</entry>
</row>
<row>
<entry><literal>"d"</literal></entry>
<entry>private key</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</listitem>
</itemizedlist>
</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
-->