1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
project.
Copyright (C) 1998-2018 OpenLink Software
This project is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; only version 2 of the License, dated June 1991.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
: template.sh,v 1.5 2006/04/18 21:59:13 ivan Exp $
-->
<refentry id="fn_xenc_pem_export">
<refmeta>
<refentrytitle>xenc_pem_export</refentrytitle>
<refmiscinfo>hash</refmiscinfo>
</refmeta>
<refnamediv>
<refname>xenc_pem_export</refname>
<refpurpose>Export of a certificate and optionally private key in PEM format</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis id="fsyn_xenc_pem_export">
<funcprototype id="fproto_xenc_pem_export">
<funcdef><function>xenc_pem_export</function></funcdef>
<paramdef>in <parameter>key_name</parameter> varchar</paramdef>
<paramdef>in <parameter>pk_flag</parameter> integer</paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1 id="desc_xenc_pem_export">
<title>Description</title>
<para>The function is used to export certificate in PEM format, optionally it can export also private key (if present)</para>
</refsect1>
<refsect1 id="params_xenc_pem_export">
<title>Parameters</title>
<refsect2><title>key_name</title>
<para>The key name which keeps the certificate</para>
</refsect2>
<refsect2><title>pk_flag</title>
<para>A flag : 1 or 0, by default 0. It denotes to export or to skip exporting private key.</para>
</refsect2>
</refsect1>
<refsect1 id="examples_xenc_pem_export">
<title>Examples</title>
<example id="ex_xenc_pem_export_1"><title>Creating a certificate and exporting it in PEM format</title>
<para>The example below imports a client public key, then it creates a certificate and sign it with CA's private key and finally it exports the generated certificate in PEM format.</para>
<screen><![CDATA[
kname := xenc_SPKI_read (null, replace (get_keyword ('key', params), '\r\n', ''));
xenc_x509_generate (
'id_rsa',
kname,
sequence_next ('ca_id_rsa'),
365,
vector (
'CN', get_keyword ('name', params, name),
'C', get_keyword ('c', params, name),
'O', get_keyword ('o', params, name),
'OU', get_keyword ('ou', params, name),
'emailAddress', get_keyword ('email', params)
),
vector (
'subjectAltName',
'URI:'||webid,
'nsComment',
'Virtuoso Generated Certificate',
'authorityKeyIdentifier',
'keyid,issuer:always'));
cvalue := xenc_pem_export (kname);
]]>
</screen>
</example>
<example id="ex_xenc_pem_export_2"><title>Export Web Server certificate for Virtuoso HTTPS endpoints</title>
<para>This example exports Web Server certificate generated for Virtuoso HTTPS Endpoint:</para>
<orderedlist>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSSetupSSL#Configure%20an%20HTTPS%20Listener%20for%20handling%20HTTPS%20requests%20from%20HTTP%20user%20agents%20%28clients%29">Configure an HTTPS Listener for handling HTTPS requests from HTTP user agents (clients).</ulink></listitem>
<listitem>Suppose the generate certificate from the previous step has name "https_key_localhost"</listitem>
<listitem>To export the certificate, execute from iSQL:
<programlisting><![CDATA[
SQL> SELECT xenc_pem_export ('https_key_localhost');
]]></programlisting>
<figure id="srv" float="1">
<title>iSQL Export Web Server Sertificate Output</title>
<graphic fileref="ui/export_srv_cert.png"/>
</figure>
</listitem>
</orderedlist>
</example>
</refsect1>
<refsect1 id="seealso_xenc_pem_export">
<title>See Also</title>
<para><link linkend="fn_xenc_SPKI_read"><function>xenc_SPKI_read</function></link></para>
<para><link linkend="fn_xenc_x509_generate"><function>xenc_xenc_x509_generate</function></link></para>
</refsect1>
</refentry>
|