<!--
   $FML: openssl.sgml,v 1.1 2001/04/28 08:16:10 fukachan Exp $
-->

<chapter id="openssl">

<title> openssl の使い方 </title>

<sect1>
<title> 非対称鍵を作る </title>

<sect2>
   <title> private key を作る </title>

<para>
<screen>
% openssl genrsa -des 1024 > private.pem
1120 semi-random bytes loaded
Generating RSA private key, 1024 bit long modulus
...................+++++
.............+++++
e is 65537 (0x10001)
Enter PEM pass phrase:
Verifying password - Enter PEM pass phrase:
% ls
private.pem
</screen>
</para>
</sect2>

<sect2>
   <title> create key to be submitted to CA </title>

<screen>
% openssl req -new -key private.pem -out csr.pem
Using configuration from /usr/local/ssl/openssl.cnf
Enter PEM pass phrase:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:JP
State or Province Name (full name) [Some-State]:Hokkaido
Locality Name (eg, city) []:Sapporo
Organization Name (eg, company) [Internet Widgits Pty Ltd]:fml project
Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) []:beth.fml.org
Email Address []:fukachan@fml.org

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
% ls
csr.pem         private.pem
</screen>
</sect2>

<sect2>
  <title> sign signature by CA
          (here myself == private.pem, but it is meaningless).
  </title>

<screen>
% openssl x509 -in csr.pem -out crt.pem -req -signkey private.pem
Signature ok
subject=/C=JP/ST=Hokkaido/L=Sapporo/O=fml project/CN=beth.fml.org/Email=fukachan@fml.org
Getting Private key
Enter PEM pass phrase:
% ls
crt.pem         csr.pem         private.pem
</screen>
</sect2>

</sect1>

</chapter>
