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