Home | History | Annotate | Line # | Download | only in doc
hx509.texi revision 1.1.1.2
      1      1.1  elric \input texinfo @c -*- texinfo -*-
      2      1.1  elric @c $NetBSD: hx509.texi,v 1.1.1.2 2011/04/14 14:08:08 elric Exp $
      3      1.1  elric @c %**start of header
      4  1.1.1.2  elric @c Id
      5      1.1  elric @setfilename hx509.info
      6      1.1  elric @settitle HX509
      7      1.1  elric @iftex
      8      1.1  elric @afourpaper
      9      1.1  elric @end iftex
     10      1.1  elric @c some sensible characters, please?
     11      1.1  elric @tex
     12      1.1  elric \input latin1.tex
     13      1.1  elric @end tex
     14      1.1  elric @setchapternewpage on
     15      1.1  elric @syncodeindex pg cp
     16      1.1  elric @c %**end of header
     17      1.1  elric 
     18      1.1  elric @include vars.texi
     19      1.1  elric 
     20      1.1  elric @set VERSION @value{PACKAGE_VERSION}
     21      1.1  elric @set EDITION 1.0
     22      1.1  elric 
     23      1.1  elric @ifinfo
     24      1.1  elric @dircategory Security
     25      1.1  elric @direntry
     26      1.1  elric * hx509: (hx509).               The X.509 distribution from KTH
     27      1.1  elric @end direntry
     28      1.1  elric @end ifinfo
     29      1.1  elric 
     30      1.1  elric @c title page
     31      1.1  elric @titlepage
     32      1.1  elric @title HX509
     33      1.1  elric @subtitle X.509 distribution from KTH
     34      1.1  elric @subtitle Edition @value{EDITION}, for version @value{VERSION}
     35      1.1  elric @subtitle 2008
     36      1.1  elric @author Love Hrnquist strand
     37      1.1  elric 
     38      1.1  elric @def@copynext{@vskip 20pt plus 1fil}
     39      1.1  elric @def@copyrightstart{}
     40      1.1  elric @def@copyrightend{}
     41      1.1  elric @page
     42      1.1  elric @copyrightstart
     43      1.1  elric Copyright (c) 1994-2008 Kungliga Tekniska Hgskolan
     44      1.1  elric (Royal Institute of Technology, Stockholm, Sweden).
     45      1.1  elric All rights reserved.
     46      1.1  elric 
     47      1.1  elric Redistribution and use in source and binary forms, with or without
     48      1.1  elric modification, are permitted provided that the following conditions
     49      1.1  elric are met:
     50      1.1  elric 
     51      1.1  elric 1. Redistributions of source code must retain the above copyright
     52      1.1  elric    notice, this list of conditions and the following disclaimer.
     53      1.1  elric 
     54      1.1  elric 2. Redistributions in binary form must reproduce the above copyright
     55      1.1  elric    notice, this list of conditions and the following disclaimer in the
     56      1.1  elric    documentation and/or other materials provided with the distribution.
     57      1.1  elric 
     58      1.1  elric 3. Neither the name of the Institute nor the names of its contributors
     59      1.1  elric    may be used to endorse or promote products derived from this software
     60      1.1  elric    without specific prior written permission.
     61      1.1  elric 
     62      1.1  elric THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
     63      1.1  elric ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     64      1.1  elric IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     65      1.1  elric ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
     66      1.1  elric FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     67      1.1  elric DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     68      1.1  elric OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     69      1.1  elric HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     70      1.1  elric LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     71      1.1  elric OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     72      1.1  elric SUCH DAMAGE.
     73      1.1  elric 
     74      1.1  elric @copynext
     75      1.1  elric 
     76      1.1  elric Copyright (c) 1988, 1990, 1993
     77      1.1  elric      The Regents of the University of California.  All rights reserved.
     78      1.1  elric 
     79      1.1  elric Redistribution and use in source and binary forms, with or without
     80      1.1  elric modification, are permitted provided that the following conditions
     81      1.1  elric are met:
     82      1.1  elric 
     83      1.1  elric 1. Redistributions of source code must retain the above copyright
     84      1.1  elric    notice, this list of conditions and the following disclaimer.
     85      1.1  elric 
     86      1.1  elric 2. Redistributions in binary form must reproduce the above copyright
     87      1.1  elric    notice, this list of conditions and the following disclaimer in the
     88      1.1  elric    documentation and/or other materials provided with the distribution.
     89      1.1  elric 
     90      1.1  elric 3. Neither the name of the University nor the names of its contributors
     91      1.1  elric    may be used to endorse or promote products derived from this software
     92      1.1  elric    without specific prior written permission.
     93      1.1  elric 
     94      1.1  elric THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     95      1.1  elric ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     96      1.1  elric IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     97      1.1  elric ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     98      1.1  elric FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     99      1.1  elric DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    100      1.1  elric OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    101      1.1  elric HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    102      1.1  elric LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    103      1.1  elric OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    104      1.1  elric SUCH DAMAGE.
    105      1.1  elric 
    106      1.1  elric @copynext
    107      1.1  elric 
    108      1.1  elric Copyright 1992 Simmule Turner and Rich Salz.  All rights reserved.
    109      1.1  elric 
    110      1.1  elric This software is not subject to any license of the American Telephone
    111      1.1  elric and Telegraph Company or of the Regents of the University of California.
    112      1.1  elric 
    113      1.1  elric Permission is granted to anyone to use this software for any purpose on
    114      1.1  elric any computer system, and to alter it and redistribute it freely, subject
    115      1.1  elric to the following restrictions:
    116      1.1  elric 
    117      1.1  elric 1. The authors are not responsible for the consequences of use of this
    118      1.1  elric    software, no matter how awful, even if they arise from flaws in it.
    119      1.1  elric 
    120      1.1  elric 2. The origin of this software must not be misrepresented, either by
    121      1.1  elric    explicit claim or by omission.  Since few users ever read sources,
    122      1.1  elric    credits must appear in the documentation.
    123      1.1  elric 
    124      1.1  elric 3. Altered versions must be plainly marked as such, and must not be
    125      1.1  elric    misrepresented as being the original software.  Since few users
    126      1.1  elric    ever read sources, credits must appear in the documentation.
    127      1.1  elric 
    128      1.1  elric 4. This notice may not be removed or altered.
    129      1.1  elric 
    130      1.1  elric @copynext
    131      1.1  elric 
    132      1.1  elric IMath is Copyright 2002-2005 Michael J. Fromberger
    133      1.1  elric You may use it subject to the following Licensing Terms:
    134      1.1  elric 
    135      1.1  elric Permission is hereby granted, free of charge, to any person obtaining
    136      1.1  elric a copy of this software and associated documentation files (the
    137      1.1  elric "Software"), to deal in the Software without restriction, including
    138      1.1  elric without limitation the rights to use, copy, modify, merge, publish,
    139      1.1  elric distribute, sublicense, and/or sell copies of the Software, and to
    140      1.1  elric permit persons to whom the Software is furnished to do so, subject to
    141      1.1  elric the following conditions:
    142      1.1  elric 
    143      1.1  elric The above copyright notice and this permission notice shall be
    144      1.1  elric included in all copies or substantial portions of the Software.
    145      1.1  elric 
    146      1.1  elric THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    147      1.1  elric EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    148      1.1  elric MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    149      1.1  elric IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
    150      1.1  elric CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
    151      1.1  elric TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
    152      1.1  elric SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    153      1.1  elric 
    154      1.1  elric @copyrightend
    155      1.1  elric @end titlepage
    156      1.1  elric 
    157      1.1  elric @macro manpage{man, section}
    158      1.1  elric @cite{\man\(\section\)}
    159      1.1  elric @end macro
    160      1.1  elric 
    161      1.1  elric @c Less filling! Tastes great!
    162      1.1  elric @iftex
    163      1.1  elric @parindent=0pt
    164      1.1  elric @global@parskip 6pt plus 1pt
    165      1.1  elric @global@chapheadingskip = 15pt plus 4pt minus 2pt
    166      1.1  elric @global@secheadingskip = 12pt plus 3pt minus 2pt
    167      1.1  elric @global@subsecheadingskip = 9pt plus 2pt minus 2pt
    168      1.1  elric @end iftex
    169      1.1  elric @ifinfo
    170      1.1  elric @paragraphindent 0
    171      1.1  elric @end ifinfo
    172      1.1  elric 
    173      1.1  elric @ifnottex
    174      1.1  elric @node Top, Introduction, (dir), (dir)
    175      1.1  elric @top Heimdal
    176      1.1  elric @end ifnottex
    177      1.1  elric 
    178      1.1  elric This manual is for version @value{VERSION} of hx509.
    179      1.1  elric 
    180      1.1  elric @menu
    181      1.1  elric * Introduction::
    182      1.1  elric * What is X.509 ?::
    183      1.1  elric * Setting up a CA::
    184      1.1  elric * CMS signing and encryption::
    185      1.1  elric * Certificate matching::
    186      1.1  elric * Software PKCS 11 module::
    187      1.1  elric 
    188      1.1  elric @detailmenu
    189      1.1  elric  --- The Detailed Node Listing ---
    190      1.1  elric 
    191      1.1  elric Setting up a CA
    192      1.1  elric 
    193      1.1  elric @c * Issuing certificates::
    194      1.1  elric * Creating a CA certificate::
    195      1.1  elric * Issuing certificates::
    196      1.1  elric * Issuing CRLs::
    197      1.1  elric @c * Issuing a proxy certificate::
    198      1.1  elric @c * Creating a user certificate::
    199      1.1  elric @c * Validating a certificate::
    200      1.1  elric @c * Validating a certificate path::
    201      1.1  elric * Application requirements::
    202      1.1  elric 
    203      1.1  elric CMS signing and encryption
    204      1.1  elric 
    205      1.1  elric * CMS background::
    206      1.1  elric 
    207      1.1  elric Certificate matching
    208      1.1  elric 
    209      1.1  elric * Matching syntax::
    210      1.1  elric 
    211      1.1  elric Software PKCS 11 module
    212      1.1  elric 
    213      1.1  elric * How to use the PKCS11 module::
    214      1.1  elric 
    215      1.1  elric @end detailmenu
    216      1.1  elric @end menu
    217      1.1  elric 
    218      1.1  elric @node Introduction, What is X.509 ?, Top, Top
    219      1.1  elric @chapter Introduction
    220      1.1  elric 
    221      1.1  elric The goals of a PKI infrastructure (as defined in 
    222      1.1  elric <a href="http://www.ietf.org/rfc/rfc3280.txt">RFC 3280</a>) is to meet 
    223      1.1  elric @emph{the needs of deterministic, automated identification, authentication, access control, and authorization}.
    224      1.1  elric 
    225      1.1  elric 
    226      1.1  elric The administrator should be aware of certain terminologies as explained by the aforementioned
    227      1.1  elric RFC before attemping to put in place a PKI infrastructure. Briefly, these are: 
    228      1.1  elric 
    229      1.1  elric @itemize @bullet
    230      1.1  elric @item CA
    231      1.1  elric Certificate Authority
    232      1.1  elric @item RA
    233      1.1  elric Registration Authority, i.e., an optional system to which a CA delegates certain management functions.
    234      1.1  elric @item CRL Issuer
    235      1.1  elric An optional system to which a CA delegates the publication of certificate revocation lists.
    236      1.1  elric @item Repository
    237      1.1  elric A system or collection of distributed systems that stores certificates and CRLs 
    238      1.1  elric and serves as a means of distributing these certificates and CRLs to end entities
    239      1.1  elric @end itemize
    240      1.1  elric 
    241      1.1  elric hx509 (Heimdal x509 support) is a near complete X.509 stack that can
    242      1.1  elric handle CMS messages (crypto system used in S/MIME and Kerberos PK-INIT)
    243      1.1  elric and basic certificate processing tasks, path construction, path
    244      1.1  elric validation, OCSP and CRL validation, PKCS10 message construction, CMS
    245      1.1  elric Encrypted (shared secret encrypted), CMS SignedData (certificate
    246      1.1  elric signed), and CMS EnvelopedData (certificate encrypted).
    247      1.1  elric 
    248      1.1  elric hx509 can use PKCS11 tokens, PKCS12 files, PEM files, and/or DER encoded
    249      1.1  elric files.
    250      1.1  elric 
    251      1.1  elric @node What is X.509 ?, Setting up a CA, Introduction, Top
    252      1.1  elric @chapter What is X.509, PKIX, PKCS7 and CMS ? 
    253      1.1  elric 
    254      1.1  elric X.509 was created by CCITT (later ITU) for the X.500 directory
    255      1.1  elric service. Today, X.509 discussions and implementations commonly reference
    256      1.1  elric the IETF's PKIX Certificate and CRL Profile of the X.509 v3 certificate
    257      1.1  elric standard, as specified in RFC 3280.
    258      1.1  elric 
    259      1.1  elric ITU continues to develop the X.509 standard together with the IETF in a 
    260      1.1  elric rather complicated dance.
    261      1.1  elric 
    262      1.1  elric X.509 is a public key based security system that has associated data
    263      1.1  elric stored within a so called certificate. Initially, X.509 was a strict
    264      1.1  elric hierarchical system with one root. However, ever evolving requiments and
    265      1.1  elric technology advancements saw the inclusion of multiple policy roots,
    266      1.1  elric bridges and mesh solutions.
    267      1.1  elric 
    268      1.1  elric x.509 can also be used as a peer to peer system, though often seen as a
    269      1.1  elric common scenario.
    270      1.1  elric 
    271      1.1  elric @section Type of certificates
    272      1.1  elric 
    273      1.1  elric There are several flavors of certificate in X.509.
    274      1.1  elric 
    275      1.1  elric @itemize @bullet
    276      1.1  elric 
    277      1.1  elric @item Trust anchors
    278      1.1  elric 
    279      1.1  elric Trust anchors are strictly not certificates, but commonly stored in a
    280      1.1  elric certificate format as they become easier to manage. Trust anchors are
    281      1.1  elric the keys that an end entity would trust to validate other certificates.
    282      1.1  elric This is done by building a path from the certificate you want to
    283      1.1  elric validate to to any of the trust anchors you have.
    284      1.1  elric 
    285      1.1  elric @item End Entity (EE) certificates
    286      1.1  elric 
    287      1.1  elric End entity certificates are the most common types of certificates. End
    288      1.1  elric entity certificates cannot issue (sign) certificate themselves and are generally
    289      1.1  elric used to authenticate and authorize users and services.
    290      1.1  elric 
    291      1.1  elric @item Certification Authority (CA) certificates
    292      1.1  elric 
    293      1.1  elric Certificate authority certificates have the right to issue additional
    294      1.1  elric certificates (be it sub-ordinate CA certificates to build an trust anchors
    295      1.1  elric or end entity certificates). There is no limit to how many certificates a CA
    296      1.1  elric may issue, but there might other restrictions, like the maximum path
    297      1.1  elric depth.
    298      1.1  elric 
    299      1.1  elric @item Proxy certificates
    300      1.1  elric 
    301      1.1  elric Remember the statement "End Entity certificates cannot issue
    302      1.1  elric certificates"?  Well that statement is not entirely true. There is an
    303      1.1  elric extension called proxy certificates defined in RFC3820, that allows
    304      1.1  elric certificates to be issued by end entity certificates. The service that
    305      1.1  elric receives the proxy certificates must have explicitly turned on support
    306      1.1  elric for proxy certificates, so their use is somewhat limited.
    307      1.1  elric 
    308      1.1  elric Proxy certificates can be limited by policies stored in the certificate to
    309      1.1  elric what they can be used for. This allows users to delegate the proxy
    310      1.1  elric certificate to services (by sending over the certificate and private
    311      1.1  elric key) so the service can access services on behalf of the user.
    312      1.1  elric 
    313      1.1  elric One example of this would be a print service. The user wants to print a
    314      1.1  elric large job in the middle of the night when the printer isn't used that
    315      1.1  elric much, so the user creates a proxy certificate with the policy that it
    316      1.1  elric can only be used to access files related to this print job, creates the
    317      1.1  elric print job description and send both the description and proxy
    318      1.1  elric certificate with key over to print service. Later at night when the
    319      1.1  elric print service initializes (without any user intervention), access to the files 
    320      1.1  elric for the print job is granted via the proxy certificate. As a result of (in-place) 
    321      1.1  elric policy limitations, the certificate cannot be used for any other purposes.
    322      1.1  elric 
    323      1.1  elric @end itemize
    324      1.1  elric 
    325      1.1  elric @section Building a path
    326      1.1  elric 
    327      1.1  elric Before validating a certificate path (or chain), the path needs to be
    328      1.1  elric constructed.  Given a certificate (EE, CA, Proxy, or any other type),
    329      1.1  elric the path construction algorithm will try to find a path to one of the
    330      1.1  elric trust anchors.
    331      1.1  elric 
    332      1.1  elric The process starts by looking at the issuing CA of the certificate, by
    333      1.1  elric Name or Key Identifier, and tries to find that certificate while at the
    334      1.1  elric same time evaluting any policies in-place.
    335      1.1  elric 
    336      1.1  elric @node Setting up a CA, Creating a CA certificate, What is X.509 ?, Top
    337      1.1  elric @chapter Setting up a CA
    338      1.1  elric 
    339      1.1  elric Do not let information overload scare you off! If you are simply testing
    340      1.1  elric or getting started with a PKI infrastructure, skip all this and go to
    341      1.1  elric the next chapter (see: @pxref{Creating a CA certificate}).
    342      1.1  elric 
    343      1.1  elric Creating a CA certificate should be more the just creating a
    344      1.1  elric certificate, CA's should define a policy. Again, if you are simply
    345      1.1  elric testing a PKI, policies do not matter so much. However, when it comes to
    346      1.1  elric trust in an organisation, it will probably matter more whom your users
    347      1.1  elric and sysadmins will find it acceptable to trust.
    348      1.1  elric 
    349      1.1  elric At the same time, try to keep things simple, it's not very hard to run a
    350      1.1  elric Certificate authority and the process to get new certificates should be simple.
    351      1.1  elric 
    352      1.1  elric You may find it helpful to answer the following policy questions for
    353      1.1  elric your organization at a later stage:
    354      1.1  elric 
    355      1.1  elric @itemize @bullet
    356      1.1  elric @item How do you trust your CA.
    357      1.1  elric @item What is the CA responsibility.
    358      1.1  elric @item Review of CA activity.
    359      1.1  elric @item How much process should it be to issue certificate.
    360      1.1  elric @item Who is allowed to issue certificates.
    361      1.1  elric @item Who is allowed to requests certificates.
    362      1.1  elric @item How to handle certificate revocation, issuing CRLs and maintain OCSP services.
    363      1.1  elric @end itemize
    364      1.1  elric 
    365      1.1  elric @node Creating a CA certificate, Issuing certificates, Setting up a CA, Top
    366      1.1  elric @section Creating a CA certificate
    367      1.1  elric 
    368      1.1  elric This section describes how to create a CA certificate and what to think
    369      1.1  elric about.
    370      1.1  elric 
    371      1.1  elric @subsection Lifetime CA certificate
    372      1.1  elric 
    373      1.1  elric You probably want to create a CA certificate with a long lifetime, 10
    374      1.1  elric years at the very minimum. This is because you don't want to push out the
    375      1.1  elric certificate (as a trust anchor) to all you users again when the old
    376      1.1  elric CA certificate expires. Although a trust anchor can't really expire, not all
    377      1.1  elric software works in accordance with published standards.
    378      1.1  elric 
    379      1.1  elric Keep in mind the security requirements might be different 10-20 years
    380      1.1  elric into the future. For example, SHA1 is going to be withdrawn in 2010, so
    381      1.1  elric make sure you have enough buffering in your choice of digest/hash
    382      1.1  elric algorithms, signature algorithms and key lengths.
    383      1.1  elric 
    384      1.1  elric @subsection Create a CA certificate
    385      1.1  elric 
    386      1.1  elric This command below can be used to generate a self-signed CA certificate.
    387      1.1  elric 
    388      1.1  elric @example
    389      1.1  elric hxtool issue-certificate \
    390      1.1  elric     --self-signed \
    391      1.1  elric     --issue-ca \
    392      1.1  elric     --generate-key=rsa \
    393      1.1  elric     --subject="CN=CertificateAuthority,DC=test,DC=h5l,DC=se" \
    394      1.1  elric     --lifetime=10years \
    395      1.1  elric     --certificate="FILE:ca.pem"
    396      1.1  elric @end example
    397      1.1  elric 
    398      1.1  elric @subsection Extending the lifetime of a CA certificate
    399      1.1  elric 
    400      1.1  elric You just realised that your CA certificate is going to expire soon and
    401      1.1  elric that you need replace it with a new CA. The easiest way to do that
    402      1.1  elric is to extend the lifetime of your existing CA certificate.
    403      1.1  elric 
    404      1.1  elric The example below will extend the CA certificate's lifetime by 10 years. 
    405      1.1  elric You should compare this new certificate if it contains all the
    406      1.1  elric special tweaks as the old certificate had.
    407      1.1  elric 
    408      1.1  elric @example
    409      1.1  elric hxtool issue-certificate \
    410      1.1  elric     --self-signed \
    411      1.1  elric     --issue-ca \
    412      1.1  elric     --lifetime="10years" \
    413      1.1  elric     --template-certificate="FILE:ca.pem" \
    414      1.1  elric     --template-fields="serialNumber,notBefore,subject,SPKI" \
    415      1.1  elric     --ca-private-key=FILE:ca.pem \
    416      1.1  elric     --certificate="FILE:new-ca.pem"
    417      1.1  elric @end example
    418      1.1  elric 
    419      1.1  elric @subsection Subordinate CA
    420      1.1  elric 
    421      1.1  elric This example below creates a new subordinate certificate authority.
    422      1.1  elric 
    423      1.1  elric @example
    424      1.1  elric hxtool issue-certificate \
    425      1.1  elric     --ca-certificate=FILE:ca.pem \
    426      1.1  elric     --issue-ca \
    427      1.1  elric     --generate-key=rsa \
    428      1.1  elric     --subject="CN=CertificateAuthority,DC=dev,DC=test,DC=h5l,DC=se" \
    429      1.1  elric     --certificate="FILE:dev-ca.pem"
    430      1.1  elric @end example
    431      1.1  elric 
    432      1.1  elric 
    433      1.1  elric @node Issuing certificates, Issuing CRLs, Creating a CA certificate, Top
    434      1.1  elric @section Issuing certificates
    435      1.1  elric 
    436      1.1  elric First you'll create a CA certificate, after that you have to deal with
    437      1.1  elric your users and servers and issue certificates to them.
    438      1.1  elric 
    439      1.1  elric @c I think this section needs a bit of clarity. Can I add a separate
    440      1.1  elric @c section which explains CSRs as well?
    441      1.1  elric 
    442      1.1  elric 
    443      1.1  elric @itemize @bullet
    444      1.1  elric 
    445      1.1  elric @item Do all the work themself
    446      1.1  elric 
    447      1.1  elric Generate the key for the user. This has the problme that the the CA
    448      1.1  elric knows the private key of the user. For a paranoid user this might leave
    449      1.1  elric feeling of disconfort.
    450      1.1  elric 
    451      1.1  elric @item Have the user do part of the work
    452      1.1  elric 
    453      1.1  elric Receive PKCS10 certificate requests fromusers. PKCS10 is a request for a
    454      1.1  elric certificate.  The user may specify what DN they want as well as provide
    455      1.1  elric a certificate signing request (CSR).  To prove the user have the key,
    456      1.1  elric the whole request is signed by the private key of the user.
    457      1.1  elric 
    458      1.1  elric @end itemize
    459      1.1  elric 
    460      1.1  elric @subsection Name space management
    461      1.1  elric 
    462      1.1  elric @c The explanation given below is slightly unclear. I will re-read the
    463      1.1  elric @c RFC and document accordingly
    464      1.1  elric 
    465      1.1  elric What people might want to see.
    466      1.1  elric 
    467      1.1  elric Re-issue certificates just because people moved within the organization.
    468      1.1  elric 
    469      1.1  elric Expose privacy information.
    470      1.1  elric 
    471      1.1  elric Using Sub-component name (+ notation).
    472      1.1  elric 
    473      1.1  elric @subsection Certificate Revocation, CRL and OCSP
    474      1.1  elric 
    475      1.1  elric Certificates that a CA issues may need to be revoked at some stage. As
    476      1.1  elric an example, an employee leaves the organization and does not bother
    477      1.1  elric handing in his smart card (or even if the smart card is handed back --
    478      1.1  elric the certificate on it must no longer be acceptable to services; the
    479      1.1  elric employee has left).
    480      1.1  elric 
    481      1.1  elric You may also want to revoke a certificate for a service which is no
    482      1.1  elric longer being offered on your network. Overlooking these scenarios can
    483      1.1  elric lead to security holes which will quickly become a nightmare to deal
    484      1.1  elric with.
    485      1.1  elric 
    486      1.1  elric There are two primary protocols for dealing with certificate
    487      1.1  elric revokation. Namely:
    488      1.1  elric 
    489      1.1  elric @itemize @bullet
    490      1.1  elric @item Certificate Revocation List (CRL)
    491      1.1  elric @item Online Certificate Status Protocol (OCSP)
    492      1.1  elric @end itemize
    493      1.1  elric 
    494      1.1  elric If however the certificate in qeustion has been destroyed, there is no
    495      1.1  elric need to revoke the certificate because it can not be used by someone
    496      1.1  elric else. This matter since for each certificate you add to CRL, the
    497      1.1  elric download time and processing time for clients are longer.
    498      1.1  elric 
    499      1.1  elric CRLs and OCSP responders however greatly help manage compatible services
    500      1.1  elric which may authenticate and authorize users (or services) on an on-going
    501      1.1  elric basis. As an example, VPN connectivity established via certificates for
    502      1.1  elric connecting clients would require your VPN software to make use of a CRL
    503      1.1  elric or an OCSP service to ensure revoked certificates belonging to former
    504      1.1  elric clients are not allowed access to (formerly subscribed) network
    505      1.1  elric services.
    506      1.1  elric 
    507      1.1  elric 
    508      1.1  elric @node Issuing CRLs, Application requirements, Issuing certificates, Top
    509      1.1  elric @section Issuing CRLs
    510      1.1  elric 
    511      1.1  elric Create an empty CRL with no certificates revoked. Default expiration
    512      1.1  elric value is one year from now.
    513      1.1  elric 
    514      1.1  elric @example
    515      1.1  elric hxtool crl-sign \
    516      1.1  elric 	--crl-file=crl.der \
    517      1.1  elric 	--signer=FILE:ca.pem
    518      1.1  elric @end example
    519      1.1  elric 
    520      1.1  elric Create a CRL with all certificates in the directory
    521      1.1  elric @file{/path/to/revoked/dir} included in the CRL as revoked.  Also make
    522      1.1  elric it expire one month from now.
    523      1.1  elric 
    524      1.1  elric @example
    525      1.1  elric hxtool crl-sign \
    526      1.1  elric 	--crl-file=crl.der \
    527      1.1  elric         --signer=FILE:ca.pem \
    528      1.1  elric 	--lifetime='1 month' \
    529      1.1  elric         DIR:/path/to/revoked/dir
    530      1.1  elric @end example
    531      1.1  elric 
    532      1.1  elric @node Application requirements, CMS signing and encryption, Issuing CRLs, Top
    533      1.1  elric @section Application requirements
    534      1.1  elric 
    535      1.1  elric Application place different requirements on certificates. This section
    536      1.1  elric tries to expand what they are and how to use hxtool to generate
    537      1.1  elric certificates for those services.
    538      1.1  elric 
    539      1.1  elric @subsection HTTPS - server
    540      1.1  elric 
    541      1.1  elric @example
    542      1.1  elric hxtool issue-certificate \
    543      1.1  elric 	  --subject="CN=www.test.h5l.se,DC=test,DC=h5l,DC=se" \
    544      1.1  elric 	  --type="https-server" \
    545      1.1  elric           --hostname="www.test.h5l.se" \
    546      1.1  elric           --hostname="www2.test.h5l.se" \
    547      1.1  elric           ...
    548      1.1  elric @end example
    549      1.1  elric 
    550      1.1  elric @subsection HTTPS - client
    551      1.1  elric 
    552      1.1  elric @example
    553      1.1  elric hxtool issue-certificate \
    554      1.1  elric 	  --subject="UID=testus,DC=test,DC=h5l,DC=se" \
    555      1.1  elric 	  --type="https-client" \
    556      1.1  elric           ...
    557      1.1  elric @end example
    558      1.1  elric 
    559      1.1  elric @subsection S/MIME - email
    560      1.1  elric 
    561      1.1  elric There are two things that should be set in S/MIME certificates, one or
    562      1.1  elric more email addresses and an extended eku usage (EKU), emailProtection.
    563      1.1  elric 
    564      1.1  elric The email address format used in S/MIME certificates is defined in
    565      1.1  elric RFC2822, section 3.4.1 and it should be an ``addr-spec''.
    566      1.1  elric 
    567      1.1  elric There are two ways to specifify email address in certificates. The old
    568      1.1  elric way is in the subject distinguished name, @emph{this should not be used}. The
    569      1.1  elric new way is using a Subject Alternative Name (SAN).
    570      1.1  elric 
    571      1.1  elric Even though the email address is stored in certificates, they don't need
    572      1.1  elric to be, email reader programs are required to accept certificates that
    573      1.1  elric doesn't have either of the two methods of storing email in certificates
    574      1.1  elric -- in which case, the email client will try to protect the user by
    575      1.1  elric printing the name of the certificate instead.
    576      1.1  elric 
    577      1.1  elric S/MIME certificate can be used in another special way. They can be
    578      1.1  elric issued with a NULL subject distinguished name plus the email in SAN,
    579      1.1  elric this is a valid certificate. This is used when you wont want to share
    580      1.1  elric more information then you need to.
    581      1.1  elric 
    582      1.1  elric hx509 issue-certificate supports adding the email SAN to certificate by
    583      1.1  elric using the --email option, --email also gives an implicit emailProtection
    584      1.1  elric eku. If you want to create an certificate without an email address, the
    585      1.1  elric option --type=email will add the emailProtection EKU.
    586      1.1  elric 
    587      1.1  elric @example
    588      1.1  elric hxtool issue-certificate \
    589      1.1  elric 	  --subject="UID=testus-email,DC=test,DC=h5l,DC=se" \
    590      1.1  elric 	  --type=email \
    591      1.1  elric 	  --email="testus@@test.h5l.se" \
    592      1.1  elric           ...
    593      1.1  elric @end example
    594      1.1  elric 
    595      1.1  elric An example of an certificate without and subject distinguished name with
    596      1.1  elric an email address in a SAN.
    597      1.1  elric 
    598      1.1  elric @example
    599      1.1  elric hxtool issue-certificate \
    600      1.1  elric 	  --subject="" \
    601      1.1  elric 	  --type=email \
    602      1.1  elric 	  --email="testus@@test.h5l.se" \
    603      1.1  elric           ...
    604      1.1  elric @end example
    605      1.1  elric 
    606      1.1  elric @subsection PK-INIT
    607      1.1  elric 
    608      1.1  elric A PK-INIT infrastructure allows users and services to pick up kerberos
    609      1.1  elric credentials (tickets) based on their certificate. This, for example,
    610      1.1  elric allows users to authenticate to their desktops using smartcards while
    611      1.1  elric acquiring kerberos tickets in the process.
    612      1.1  elric 
    613      1.1  elric As an example, an office network which offers centrally controlled
    614      1.1  elric desktop logins, mail, messaging (xmpp) and openafs would give users
    615      1.1  elric single sign-on facilities via smartcard based logins.  Once the kerberos
    616      1.1  elric ticket has been acquired, all kerberized services would immediately
    617      1.1  elric become accessible based on deployed security policies.
    618      1.1  elric 
    619      1.1  elric Let's go over the process of initializing a demo PK-INIT framework:
    620      1.1  elric 
    621      1.1  elric @example
    622      1.1  elric hxtool issue-certificate \
    623      1.1  elric         --type="pkinit-kdc" \
    624      1.1  elric         --pk-init-principal="krbtgt/TEST.H5L.SE@@TEST.H5L.SE" \
    625      1.1  elric         --hostname=kerberos.test.h5l.se \
    626      1.1  elric         --ca-certificate="FILE:ca.pem,ca.key" \
    627      1.1  elric         --generate-key=rsa \
    628      1.1  elric         --certificate="FILE:kdc.pem" \
    629      1.1  elric         --subject="cn=kdc"
    630      1.1  elric @end example
    631      1.1  elric 
    632      1.1  elric How to create a certificate for a user.
    633      1.1  elric 
    634      1.1  elric @example
    635      1.1  elric hxtool issue-certificate \
    636      1.1  elric         --type="pkinit-client" \
    637      1.1  elric         --pk-init-principal="user@@TEST.H5L.SE" \
    638      1.1  elric         --ca-certificate="FILE:ca.pem,ca.key" \
    639      1.1  elric         --generate-key=rsa \
    640      1.1  elric         --subject="cn=Test User" \
    641      1.1  elric         --certificate="FILE:user.pem"
    642      1.1  elric @end example
    643      1.1  elric 
    644      1.1  elric The --type field can be specified multiple times. The same certificate
    645      1.1  elric can hence house extensions for both pkinit-client as well as S/MIME.
    646      1.1  elric 
    647      1.1  elric To use the PKCS11 module, please see the section:
    648      1.1  elric @pxref{How to use the PKCS11 module}.
    649      1.1  elric 
    650      1.1  elric More about how to configure the KDC, see the documentation in the
    651      1.1  elric Heimdal manual to set up the KDC.
    652      1.1  elric 
    653      1.1  elric @subsection XMPP/Jabber
    654      1.1  elric 
    655      1.1  elric The jabber server certificate should have a dNSname that is the same as
    656      1.1  elric the user entered into the application, not the same as the host name of
    657      1.1  elric the machine.
    658      1.1  elric 
    659      1.1  elric @example
    660      1.1  elric hxtool issue-certificate \
    661      1.1  elric 	  --subject="CN=xmpp1.test.h5l.se,DC=test,DC=h5l,DC=se" \
    662      1.1  elric           --hostname="xmpp1.test.h5l.se" \
    663      1.1  elric           --hostname="test.h5l.se" \
    664      1.1  elric           ...
    665      1.1  elric @end example
    666      1.1  elric 
    667      1.1  elric The certificate may also contain a jabber identifier (JID) that, if the
    668      1.1  elric receiver allows it, authorises the server or client to use that JID.
    669      1.1  elric 
    670      1.1  elric When storing a JID inside the certificate, both for server and client,
    671      1.1  elric it's stored inside a UTF8String within an otherName entity inside the
    672      1.1  elric subjectAltName, using the OID id-on-xmppAddr (1.3.6.1.5.5.7.8.5).
    673      1.1  elric 
    674      1.1  elric To read more about the requirements, see RFC3920, Extensible Messaging
    675      1.1  elric and Presence Protocol (XMPP): Core.
    676      1.1  elric 
    677      1.1  elric hxtool issue-certificate have support to add jid to the certificate
    678      1.1  elric using the option @kbd{--jid}.
    679      1.1  elric 
    680      1.1  elric @example
    681      1.1  elric hxtool issue-certificate \
    682      1.1  elric 	  --subject="CN=Love,DC=test,DC=h5l,DC=se" \
    683      1.1  elric           --jid="lha@@test.h5l.se" \
    684      1.1  elric           ...
    685      1.1  elric @end example
    686      1.1  elric 
    687      1.1  elric 
    688      1.1  elric @node CMS signing and encryption, CMS background, Application requirements, Top
    689      1.1  elric @chapter CMS signing and encryption
    690      1.1  elric 
    691      1.1  elric CMS is the Cryptographic Message System that among other, is used by
    692      1.1  elric S/MIME (secure email) and Kerberos PK-INIT. It's an extended version of
    693      1.1  elric the RSA, Inc standard PKCS7.
    694      1.1  elric 
    695      1.1  elric @node CMS background, Certificate matching, CMS signing and encryption, Top
    696      1.1  elric @section CMS background
    697      1.1  elric 
    698      1.1  elric 
    699      1.1  elric @node Certificate matching, Matching syntax, CMS background, Top
    700      1.1  elric @chapter Certificate matching
    701      1.1  elric 
    702      1.1  elric To match certificates hx509 have a special query language to match
    703      1.1  elric certifictes in queries and ACLs.
    704      1.1  elric 
    705      1.1  elric @node Matching syntax, Software PKCS 11 module, Certificate matching, Top
    706      1.1  elric @section Matching syntax
    707      1.1  elric 
    708      1.1  elric This is the language definitions somewhat slopply descriped:
    709      1.1  elric 
    710      1.1  elric @example
    711      1.1  elric 
    712      1.1  elric expr = TRUE, 
    713      1.1  elric      FALSE,
    714      1.1  elric      ! expr,
    715      1.1  elric      expr AND expr,
    716      1.1  elric      expr OR expr,
    717      1.1  elric      ( expr )
    718      1.1  elric      compare
    719      1.1  elric 
    720      1.1  elric compare =
    721      1.1  elric      word == word,
    722      1.1  elric      word != word,
    723      1.1  elric      word IN ( word [, word ...])
    724      1.1  elric      word IN %@{variable.subvariable@}
    725      1.1  elric 
    726      1.1  elric word =
    727      1.1  elric      STRING,
    728      1.1  elric      %@{variable@}
    729      1.1  elric 
    730      1.1  elric @end example
    731      1.1  elric 
    732      1.1  elric @node Software PKCS 11 module, How to use the PKCS11 module, Matching syntax, Top
    733      1.1  elric @chapter Software PKCS 11 module
    734      1.1  elric 
    735      1.1  elric PKCS11 is a standard created by RSA, Inc to support hardware and
    736      1.1  elric software encryption modules. It can be used by smartcard to expose the
    737      1.1  elric crypto primitives inside without exposing the crypto keys.
    738      1.1  elric 
    739      1.1  elric Hx509 includes a software implementation of PKCS11 that runs within the
    740      1.1  elric memory space of the process and thus exposes the keys to the
    741      1.1  elric application.
    742      1.1  elric 
    743      1.1  elric @node How to use the PKCS11 module, , Software PKCS 11 module, Top
    744      1.1  elric @section How to use the PKCS11 module
    745      1.1  elric 
    746      1.1  elric @example
    747      1.1  elric $ cat > ~/.soft-pkcs11.rc <<EOF
    748      1.1  elric mycert	cert	User certificate	FILE:/Users/lha/Private/pkinit.pem
    749      1.1  elric app-fatal	true
    750      1.1  elric EOF
    751      1.1  elric $ kinit -C PKCS11:/usr/heimdal/lib/hx509.so lha@@EXAMPLE.ORG
    752      1.1  elric @end example
    753      1.1  elric 
    754      1.1  elric 
    755      1.1  elric @c @shortcontents
    756      1.1  elric @contents
    757      1.1  elric 
    758      1.1  elric @bye
    759