Skip to content

Commit

Permalink
initial translation in openssl/functions
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardolara committed Oct 25, 2024
1 parent e97f362 commit 98d0da6
Show file tree
Hide file tree
Showing 4 changed files with 811 additions and 0 deletions.
138 changes: 138 additions & 0 deletions reference/openssl/functions/openssl-csr-get-public-key.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 497c40ac164d5873fd87f622dfdeb5206392b446 Maintainer: leonardolara Status: ready -->
<refentry xml:id="function.openssl-csr-get-public-key" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>openssl_csr_get_public_key</refname>
<refpurpose>Retorna a chave pública de um <acronym>CSR</acronym></refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>OpenSSLAsymmetricKey</type><type>false</type></type><methodname>openssl_csr_get_public_key</methodname>
<methodparam><type class="union"><type>OpenSSLCertificateSigningRequest</type><type>string</type></type><parameter>csr</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>short_names</parameter><initializer>&true;</initializer></methodparam>
</methodsynopsis>
<para>
<function>openssl_csr_get_public_key</function> extrai a chave pública de
<parameter>csr</parameter> e a prepara para uso por outras funções.
</para>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
&openssl.param.csr;
<varlistentry>
<term><parameter>short_names</parameter></term>
<listitem>
<warning>
<para>
Este parâmetro é ignorado
</para>
</warning>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Retorna um <classname>OpenSSLAsymmetricKey</classname> em caso de sucesso ou &false; em caso de erro.
</para>
</refsect1>

<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.0.0</entry>
<entry>
Em caso de sucesso, esta função retorna uma instância <classname>OpenSSLAsymmetricKey</classname> agora;
anteriormente, retornava um &resource; do tipo <literal>OpenSSL key</literal>.
</entry>
</row>
<row>
<entry>8.0.0</entry>
<entry>
<parameter>csr</parameter> aceita uma instância <classname>OpenSSLCertificateSigningRequest</classname> agora;
anteriormente, um &resource; do tipo <literal>OpenSSL X.509 CSR</literal> era aceito.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Exemplo de openssl_csr_get_public_key()</title>
<programlisting role="php">
<![CDATA[
<?php
$subject = array(
"commonName" => "example.com",
);
$private_key = openssl_pkey_new(array(
"private_key_bits" => 2048,
"private_key_type" => OPENSSL_KEYTYPE_RSA,
));
$csr = openssl_csr_new($subject, $private_key, array('digest_alg' => 'sha256') );
$public_key = openssl_csr_get_public_key($csr);
$info = openssl_pkey_get_details($public_key);
echo $info['key'];
?>
]]>
</programlisting>
</example>
</para>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>openssl_csr_get_subject</function></member>
<member><function>openssl_csr_new</function></member>
<member><function>openssl_pkey_get_details</function></member>
<member><function>openssl_pkey_export_to_file</function></member>
<member><function>openssl_pkey_export</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
-->
153 changes: 153 additions & 0 deletions reference/openssl/functions/openssl-csr-get-subject.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 4cbf706028112c177d4a6a0a81a3e4520ae839e9 Maintainer: leonardolara Status: ready -->
<refentry xml:id="function.openssl-csr-get-subject" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>openssl_csr_get_subject</refname>
<refpurpose>Retorna o assunto de um <acronym>CSR</acronym></refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>array</type><type>false</type></type><methodname>openssl_csr_get_subject</methodname>
<methodparam><type class="union"><type>OpenSSLCertificateSigningRequest</type><type>string</type></type><parameter>csr</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>short_names</parameter><initializer>&true;</initializer></methodparam>
</methodsynopsis>
<para>
<function>openssl_csr_get_subject</function> retorna informações de nome distinto
do assunto codificadas em <parameter>csr</parameter>
incluindo os campos commonName (CN), OrganizationName (O), countryName (C) etc.
</para>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
&openssl.param.csr;
<varlistentry>
<term><parameter>short_names</parameter></term>
<listitem>
<para>
<parameter>short_names</parameter> controla como os dados são indexados no
array - se <parameter>short_names</parameter> for &true; (o padrão),
os campos serão indexados com o formato de nome abreviado, caso contrário, o formato de
nome longo será usado - por exemplo: CN é o formato de nome abreviado de commonName.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an associative array with subject description, &return.falseforfailure;.
</para>
</refsect1>

<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.0.0</entry>
<entry>
<parameter>csr</parameter> aceita uma instância <classname>OpenSSLCertificateSigningRequest</classname> agora;
anteriormente, um &resource; do tipo <literal>OpenSSL X.509 CSR</literal> era aceito.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Exemplo de openssl_csr_get_subject()</title>
<programlisting role="php">
<![CDATA[
<?php
$subject = array(
"countryName" => "CA",
"stateOrProvinceName" => "Alberta",
"localityName" => "Calgary",
"organizationName" => "XYZ Widgets Inc",
"organizationalUnitName" => "PHP Documentation Team",
"commonName" => "Wez Furlong",
"emailAddress" => "[email protected]",
);
$private_key = openssl_pkey_new(array(
"private_key_bits" => 2048,
"private_key_type" => OPENSSL_KEYTYPE_RSA,
));
$configargs = array(
'digest_alg' => 'sha512WithRSAEncryption'
);
$csr = openssl_csr_new($subject, $privkey, $configargs);
print_r(openssl_csr_get_subject($csr));
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Array
(
[C] => CA
[ST] => Alberta
[L] => Calgary
[O] => XYZ Widgets Inc
[OU] => PHP Documentation Team
[CN] => Wez Furlong
[emailAddress] => [email protected]
)
]]>
</screen>

</example>
</para>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>openssl_csr_new</function></member>
<member><function>openssl_csr_get_public_key</function></member>
<member><function>openssl_x509_parse</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
-->
Loading

0 comments on commit 98d0da6

Please sign in to comment.