Files
heimdal/doc/hx509.texi
Love Hörnquist Åstrand 2f751aa1a9 More about certificates.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@19889 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-01-13 12:37:14 +00:00

543 lines
19 KiB
Plaintext

\input texinfo @c -*- texinfo -*-
@c %**start of header
@c $Id$
@setfilename hx509.info
@settitle HX509
@iftex
@afourpaper
@end iftex
@c some sensible characters, please?
@tex
\input latin1.tex
@end tex
@setchapternewpage on
@syncodeindex pg cp
@c %**end of header
@c @include version.texi
@set UPDATED $Date$
@set EDITION 0.1
@set VERSION 0.8
@ifinfo
@dircategory Security
@direntry
* hx509: (hx509). The X.509 distribution from KTH
@end direntry
@end ifinfo
@c title page
@titlepage
@title HX509
@subtitle X.509 distribution from KTH
@subtitle Edition @value{EDITION}, for version @value{VERSION}
@subtitle 2007
@author Love Hörnquist Åstrand
@author last updated @value{UPDATED}
@def@copynext{@vskip 20pt plus 1fil@penalty-1000}
@def@copyrightstart{}
@def@copyrightend{}
@page
@copyrightstart
Copyright (c) 1994-2007 Kungliga Tekniska Högskolan
(Royal Institute of Technology, Stockholm, Sweden).
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the Institute nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
@copynext
Copyright (C) 1990 by the Massachusetts Institute of Technology
Export of this software from the United States of America may
require a specific license from the United States Government.
It is the responsibility of any person or organization contemplating
export to obtain such a license before exporting.
WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
distribute this software and its documentation for any purpose and
without fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright notice and
this permission notice appear in supporting documentation, and that
the name of M.I.T. not be used in advertising or publicity pertaining
to distribution of the software without specific, written prior
permission. M.I.T. makes no representations about the suitability of
this software for any purpose. It is provided "as is" without express
or implied warranty.
@copynext
Copyright (c) 1988, 1990, 1993
The Regents of the University of California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
@copynext
Copyright 1992 Simmule Turner and Rich Salz. All rights reserved.
This software is not subject to any license of the American Telephone
and Telegraph Company or of the Regents of the University of California.
Permission is granted to anyone to use this software for any purpose on
any computer system, and to alter it and redistribute it freely, subject
to the following restrictions:
1. The authors are not responsible for the consequences of use of this
software, no matter how awful, even if they arise from flaws in it.
2. The origin of this software must not be misrepresented, either by
explicit claim or by omission. Since few users ever read sources,
credits must appear in the documentation.
3. Altered versions must be plainly marked as such, and must not be
misrepresented as being the original software. Since few users
ever read sources, credits must appear in the documentation.
4. This notice may not be removed or altered.
@copynext
IMath is Copyright 2002-2005 Michael J. Fromberger
You may use it subject to the following Licensing Terms:
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@copynext
Copyright (c) 2005 Doug Rabson
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
@copyrightend
@end titlepage
@macro manpage{man, section}
@cite{\man\(\section\)}
@end macro
@c Less filling! Tastes great!
@iftex
@parindent=0pt
@global@parskip 6pt plus 1pt
@global@chapheadingskip = 15pt plus 4pt minus 2pt
@global@secheadingskip = 12pt plus 3pt minus 2pt
@global@subsecheadingskip = 9pt plus 2pt minus 2pt
@end iftex
@ifinfo
@paragraphindent 0
@end ifinfo
@ifnottex
@node Top, Introduction, (dir), (dir)
@top Heimdal
@end ifnottex
This manual is last updated @value{UPDATED} for version
@value{VERSION} of hx509.
@menu
* Introduction::
* What is X.509 ?::
* Setting up a CA::
* CMS signing and encryption::
@detailmenu
--- The Detailed Node Listing ---
Setting up a CA
@c * Issuing certificates::
* Creating a CA certificate::
* Issuing certificates::
@c * Issuing a proxy certificate::
@c * Creating a user certificate::
@c * Validating a certifiate::
@c * Validating a certifiate path::
* Application requirements::
CMS signing and encryption
* CMS background::
@end detailmenu
@end menu
@node Introduction, What is X.509 ?, Top, Top
@chapter Introduction
hx509 is a somewhat complete X.509 stack that can handle CMS messages
(crypto system used in S/MIME and Kerberos PK-INIT) and basic
certificate processing tasks, path construction, path validation, OCSP
and CRL validation, PKCS10 message construction, CMS Encrypted (shared
secret encrypted), CMS SignedData (certificate signed), and CMS
EnvelopedData (certificate encrypted).
hx509 can use PKCS11 tokens, PKCS12 files, PEM files, DER encoded files.
@node What is X.509 ?, Setting up a CA, Introduction, Top
@chapter What is X.509, PKIX, PKCS7 and CMS ?
X.509 is from the begining created by CCITT (later ITU) for the X.500
directory service. But today when people are talking about X.509 they
are commonly referring to IETF's PKIX Certificate and CRL Profile of the
X.509 v3 certificate standard, as specified in RFC 3280.
ITU continues to develop the X.509 standard together in a complicated
dance with IETF.
X.509 is public key based security system that have associated data
stored within a so called certificate. From the begning X.509 was a
strict hierarchical system with one root. This didn't not work so over
time X.509 got support for multiple policy roots, bridges, and mesh
solutions. You can even use it as a peer to peer system, but this is not
very common.
@section Type of certificates
There are several flavors of certificate in X.509.
@itemize @bullet
@item Trust anchors
Trust anchors are strictly not certificate, but commonly stored in
certificate since they ar easier to handle then. Trust anchor are the
keys that you trust to validate other certificate. This is done by
building a path from the certificate you wan to validate to to any of
the trust anchors you have.
@item End Entity (EE) certificates
End entity certificates is the most common type of certificate. End
entity certificates can't issue certificate them-self and is used to
authenticate and authorize user and services.
@item Certification Authority (CA) certificates
Certificate authority are certificates that have the right to issue
other certificate, they may be End entity certificates or Certificate
Authority certificates. There is no limit to how many certificates a CA
may issue, but there might other restrictions, like the maximum path
deepth.
@item Proxy certificates
Remember that End Entity can't issue certificates by them own, its not
really true. There there is an extension called proxy certificates,
defined in RFC3820, that allows certificates to be issued by end entity
certificates. The service that receives the proxy certificates must have
explicitly turned on support for proxy certificates, so their use is
somewhat limited.
@end itemize
@section Building a path
Before validating a path the path must be constructed. Given a
certificate (EE, CA, Proxy, or any other type), the path construction
algorith will try to find a path to one of the trust anchors.
It start with looking at whom issued the certificate, by name or Key
Identifier, and tries to find that certifiate while at the same time
evaluates the policy.
@node Setting up a CA, Creating a CA certificate, What is X.509 ?, Top
@chapter Setting up a CA
Do not let this chapter scare you off, its just to give you an idea how
to complicated setting up a CA can be. If you are just playing around,
skip all this and go to the next chapter, @pxref{Creating a CA
certificate}.
Creating a CA certificate should be more the just creating a
certificate, there is the policy of the CA. If its just you and your
friend that is playing around then it probably doesn't matter what the
policy is. But then it comes to trust in an organisation, it will
probably matter more whom your users and sysadmins will find it
acceptable to trust.
At the same time, try to keep thing simple, its not very hard to run a
Certificate authority and the process to get new certificates should
simple.
Fill all this in later.
How do you trust your CA.
What is the CA responsibility.
Review of CA activity.
How much process should it be to issue certificate.
Who is allowed to issue certificates.
Who is allowed to requests certificates.
@node Creating a CA certificate, Issuing certificates, Setting up a CA, Top
@section Creating a CA certificate
You probably want to create a CA certificate with a long lifetime, 10
years at the shortest. This because you dont want to push out the
certificate (as a trust anchor) to all you users once again when the old
one just expired. A trust anchor can't really expire, but not all
software works that way.
Keep in mind the security requirements might be diffrent 10-20 years
into the future. For example, SHA1 is going to be withdrawn in 2010, so
make sure you have enough buffering in your choice of digest/hash
algorithms, signature algorithms and keylenghts.
This command below will create a CA certificate in the file ca.pem.
@example
hxtool issue-certificate \
--self-signed \
--issue-ca \
--generate-key=rsa \
--subject="CN=CertificateAuthority,DC=test,DC=h5l,DC=se" \
--lifetime=10years \
--certificate="FILE:ca.pem"
@end example
@node Issuing certificates, Application requirements, Creating a CA certificate, Top
@section Issuing certificates
First you'll create a CA certificate, after that you have to deal with
your users and servers and issue certificate for them.
CA can generate the key for the user.
Can receive PKCS10 certificate requests from the users. PKCS10 is a
request for a certificate. The user can specified what DN the user wants
and what public key. To prove the user have the key, the whole request
is signed by the private key of the user.
Name space management.
What people might want to see.
Re-issue certificates just because people moved within the organization.
Expose privacy information.
Using Subcomponent name (+ notation).
@node Application requirements, CMS signing and encryption, Issuing certificates, Top
@section Application requirements
Application have different requirements on certificates. This section
tries to expand what they are and how to use hxtool to generate
certificates for those services.
@subsection HTTPS - server
@example
hxtool issue-certificate \
--subject="cn=www.test.h5l.se,dc=test,dc=h5l,dc=se" \
--type="https-server" \
--hostname="www.test.h5l.se" \
--hostname="www2.test.h5l.se" \
...
@end example
@subsection HTTPS - client
@example
hxtool issue-certificate \
--subject="uid=testus,dc=test,dc=h5l,dc=se" \
--type="https-client" \
...
@end example
@subsection S/MIME - email
There are two things that should be set in S/MIME certificates, one or
more email addresses and an extended eku usage (EKU), emailProtection.
The email address format used in S/MIME certificates is defined in
RFC2822, section 3.4.1 and it should be an ``addr-spec''.
There are two ways to specifify email address in certificates. The old
ways is in the subject distinguished name, this should not be used. The
new way is using a Subject Alternative Name (SAN).
But even though email address is stored in certificates, they don't need
to, email reader programs are required to accept certificates that
doesn't have either of the two methods of storing email in certificates.
In that case, they try to protect the user by printing the name of the
certificate instead.
S/MIME certificate can be used in another special way. They can be
issued with a NULL subject distinguished name plus the email in SAN,
this is a valid certificate. This is used when you wont want to share
more information then you need to.
hx509 issue-certificate supports adding the email SAN to certificate by
using the --email option, --email also gives an implicit emailProtection
eku. If you want to create an certificate without an email address, the
option --type=email will add the emailProtection EKU.
@example
hxtool issue-certificate \
--subject="uid=testus-email,dc=test,dc=h5l,dc=se" \
--type=email \
--email="testus@@test.h5l.se" \
...
@end example
An example of an certificate without and subject distinguished name with
an email address in a SAN.
@example
hxtool issue-certificate \
--subject="" \
--type=email \
--email="testus@@test.h5l.se" \
...
@end example
@subsection PK-INIT
@subsection XMPP/Jabber
The jabber server certificate should have a dNSname that is the same as
the user entered into the application, not the same as the hostname of
the machine.
@example
hxtool issue-certificate \
--subject="cn=xmpp1.test.h5l.se,dc=test,dc=h5l,dc=se" \
--hostname="xmpp1.test.h5l.se" \
--hostname="test.h5l.se" \
...
@end example
The certificate may also contain a jabber identifier (JID) that, if the
receiver allows it, authorises the server or client to use that JID.
When storing a JID inside the certificate, both for server and client,
its stored inside a UTF8String within an otherName entity inside the
subjectAltName, using the OID id-on-xmppAddr (1.3.6.1.5.5.7.8.5).
To read more about the requirements, see RFC3920, Extensible Messaging
and Presence Protocol (XMPP): Core.
hxtool issue-certificate have support to add jid to the certificate
using the option --jid.
@example
hxtool issue-certificate \
--subject="cn=Love,dc=test,dc=h5l,dc=se" \
--jid="lha@@test.h5l.se" \
...
@end example
@node CMS signing and encryption, CMS background, Application requirements, Top
@chapter CMS signing and encryption
CMS is the Cryptographic Message System that among other, is used by
S/MIME (secure email) and Kerberos PK-INIT. Its an extended version of
the RSA, Inc standard PKCS7.
@node CMS background, , CMS signing and encryption, Top
@section CMS background
@c @shortcontents
@contents
@bye