~statik/ubuntu/maverick/erlang/erlang-merge-testing

« back to all changes in this revision

Viewing changes to lib/ssl/doc/src/create_certs.xml

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-05-01 10:14:38 UTC
  • mfrom: (3.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090501101438-6qlr6rsdxgyzrg2z
Tags: 1:13.b-dfsg-2
* Cleaned up patches: removed unneeded patch which helped to support
  different SCTP library versions, made sure that changes for m68k
  architecture applied only when building on this architecture.
* Removed duplicated information from binary packages descriptions.
* Don't require libsctp-dev build-dependency on solaris-i386 architecture
  which allows to build Erlang on Nexenta (thanks to Tim Spriggs for
  the suggestion).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="latin1" ?>
 
2
<!DOCTYPE chapter SYSTEM "chapter.dtd">
 
3
 
 
4
<chapter>
 
5
  <header>
 
6
    <copyright>
 
7
      <year>2003</year><year>2009</year>
 
8
      <holder>Ericsson AB. All Rights Reserved.</holder>
 
9
    </copyright>
 
10
    <legalnotice>
 
11
      The contents of this file are subject to the Erlang Public License,
 
12
      Version 1.1, (the "License"); you may not use this file except in
 
13
      compliance with the License. You should have received a copy of the
 
14
      Erlang Public License along with this software. If not, it can be
 
15
      retrieved online at http://www.erlang.org/.
 
16
    
 
17
      Software distributed under the License is distributed on an "AS IS"
 
18
      basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 
19
      the License for the specific language governing rights and limitations
 
20
      under the License.
 
21
    
 
22
    </legalnotice>
 
23
 
 
24
    <title>Creating Certificates</title>
 
25
    <prepared>UAB/F/P Peter H&ouml;gfeldt</prepared>
 
26
    <docno></docno>
 
27
    <date>2003-06-16</date>
 
28
    <rev>A</rev>
 
29
    <file>create_certs.sgml</file>
 
30
  </header>
 
31
  <p>Here we consider the creation of example certificates. 
 
32
    </p>
 
33
 
 
34
  <section>
 
35
    <title>The openssl Command</title>
 
36
    <p>The <c>openssl</c> command is a utility that comes with the
 
37
      OpenSSL distribution. It provides a variety of subcommands. Each
 
38
      subcommand is invoked as</p>
 
39
    <code type="none"><![CDATA[
 
40
      openssl subcmd <options and arguments>    ]]></code>
 
41
    <p>where <c>subcmd</c> denotes the subcommand in question.
 
42
      </p>
 
43
    <p>We shall use the following subcommands to create certificates for
 
44
      the purpose of testing Erlang/OTP SSL:
 
45
      </p>
 
46
    <list type="bulleted">
 
47
      <item><em>req</em> to create certificate requests and a
 
48
       self-signed certificates, 
 
49
      </item>
 
50
      <item><em>ca</em> to create certificates from certificate requests.</item>
 
51
    </list>
 
52
    <p>We create the following certificates:
 
53
      </p>
 
54
    <list type="bulleted">
 
55
      <item>the <em>erlangCA</em> root certificate (a self-signed
 
56
       certificate), </item>
 
57
      <item>the <em>otpCA</em> certificate signed by the <em>erlangCA</em>, </item>
 
58
      <item>a client certificate signed by the <em>otpCA</em>, and</item>
 
59
      <item>a server certificate signed by the <em>otpCA</em>.</item>
 
60
    </list>
 
61
 
 
62
    <section>
 
63
      <title>The openssl configuration file</title>
 
64
      <p>An <c>openssl</c> configuration file consist of a number of
 
65
        sections, where each section starts with one line containing
 
66
        <c>[ section_name ]</c>, where <c>section_name</c> is the name
 
67
        of the section. The first section of the file is either
 
68
        unnamed, or is named <c>[ default ]</c>. For further details
 
69
        see the OpenSSL config(5) manual page.
 
70
        </p>
 
71
      <p>The required sections for the subcommands we are going to 
 
72
        use are as follows:
 
73
        </p>
 
74
      <table>
 
75
        <row>
 
76
          <cell align="left" valign="middle">subcommand</cell>
 
77
          <cell align="left" valign="middle">required/default section</cell>
 
78
          <cell align="left" valign="middle">override command line option</cell>
 
79
          <cell align="left" valign="middle">configuration file option</cell>
 
80
        </row>
 
81
        <row>
 
82
          <cell align="left" valign="middle">req</cell>
 
83
          <cell align="left" valign="middle">[req]</cell>
 
84
          <cell align="left" valign="middle">-</cell>
 
85
          <cell align="left" valign="middle"><c>-config FILE</c></cell>
 
86
        </row>
 
87
        <row>
 
88
          <cell align="left" valign="middle">ca</cell>
 
89
          <cell align="left" valign="middle">[ca]</cell>
 
90
          <cell align="left" valign="middle"><c>-name section</c></cell>
 
91
          <cell align="left" valign="middle"><c>-config FILE</c></cell>
 
92
        </row>
 
93
        <tcaption>openssl subcommands to use</tcaption>
 
94
      </table>
 
95
    </section>
 
96
 
 
97
    <section>
 
98
      <title>Creating the Erlang root CA</title>
 
99
      <p>The Erlang root CA is created with the command</p>
 
100
      <code type="none">
 
101
\011openssl req -new -x509 -config /some/path/req.cnf \\
 
102
\011    -keyout /some/path/key.pem -out /some/path/cert.pem      </code>
 
103
      <p>where the option <c>-new</c> indicates that we want to create
 
104
        a new certificate request and the option <c>-x509</c> implies
 
105
        that a self-signed certificate is created.
 
106
        </p>
 
107
    </section>
 
108
 
 
109
    <section>
 
110
      <title>Creating the OTP CA</title>
 
111
      <p>The OTP CA is created by first creating a certificate request
 
112
        with the command</p>
 
113
      <code type="none">
 
114
\011openssl req -new -config /some/path/req.cnf \\
 
115
\011    -keyout /some/path/key.pem -out /some/path/req.pem      </code>
 
116
      <p>and the ask the Erlang CA to sign it:</p>
 
117
      <code type="none">
 
118
\011openssl ca -batch -notext -config /some/path/req.cnf \\
 
119
\011   -extensions ca_cert -in /some/path/req.pem -out /some/path/cert.pem      </code>
 
120
      <p>where the option <c>-extensions</c> refers to a section in the
 
121
        configuration file saying that it should create a CA certificate, 
 
122
        and not a plain user certificate. 
 
123
        </p>
 
124
      <p>The <c>client</c> and <c>server</c> certificates are created
 
125
        similarly, except that the option <c>-extensions</c> then has the 
 
126
        value <c>user_cert</c>.  
 
127
        </p>
 
128
    </section>
 
129
  </section>
 
130
 
 
131
  <section>
 
132
    <title>An Example</title>
 
133
    <p>The following module <c>create_certs</c> is used by the Erlang/OTP
 
134
      SSL application for generating certificates to be used in tests. The
 
135
      source code is also found in <c>ssl-X.Y.Z/examples/certs/src</c>.
 
136
      </p>
 
137
    <p>The purpose of the <c>create_certs:all/1</c> function is to make
 
138
      it possible to provide from the <c>erl</c> command line, the
 
139
      full path name of the <c>openssl</c> command.
 
140
      </p>
 
141
    <p>Note that the module creates temporary OpenSSL configuration files
 
142
      for the <c>req</c> and <c>ca</c> subcommands. 
 
143
      </p>
 
144
    <codeinclude file="../../examples/certs/src/make_certs.erl" tag="" type="erl"></codeinclude>
 
145
  </section>
 
146
</chapter>
 
147
 
 
148