1c19800e8SDoug Rabson\input texinfo @c -*- texinfo -*- 2c19800e8SDoug Rabson@c %**start of header 3c19800e8SDoug Rabson@c $Id: hx509.texi 22071 2007-11-14 20:04:50Z lha $ 4c19800e8SDoug Rabson@setfilename hx509.info 5c19800e8SDoug Rabson@settitle HX509 6c19800e8SDoug Rabson@iftex 7c19800e8SDoug Rabson@afourpaper 8c19800e8SDoug Rabson@end iftex 9c19800e8SDoug Rabson@c some sensible characters, please? 10c19800e8SDoug Rabson@tex 11c19800e8SDoug Rabson\input latin1.tex 12c19800e8SDoug Rabson@end tex 13c19800e8SDoug Rabson@setchapternewpage on 14c19800e8SDoug Rabson@syncodeindex pg cp 15c19800e8SDoug Rabson@c %**end of header 16c19800e8SDoug Rabson 17c19800e8SDoug Rabson@set UPDATED $Date: 2007-11-14 12:04:50 -0800 (Ons, 14 Nov 2007) $ 18c19800e8SDoug Rabson@set VERSION 1.0 19c19800e8SDoug Rabson@set EDITION 1.0 20c19800e8SDoug Rabson 21c19800e8SDoug Rabson@ifinfo 22c19800e8SDoug Rabson@dircategory Security 23c19800e8SDoug Rabson@direntry 24c19800e8SDoug Rabson* hx509: (hx509). The X.509 distribution from KTH 25c19800e8SDoug Rabson@end direntry 26c19800e8SDoug Rabson@end ifinfo 27c19800e8SDoug Rabson 28c19800e8SDoug Rabson@c title page 29c19800e8SDoug Rabson@titlepage 30c19800e8SDoug Rabson@title HX509 31c19800e8SDoug Rabson@subtitle X.509 distribution from KTH 32c19800e8SDoug Rabson@subtitle Edition @value{EDITION}, for version @value{VERSION} 33c19800e8SDoug Rabson@subtitle 2007 34c19800e8SDoug Rabson@author Love H�rnquist �strand 35c19800e8SDoug Rabson@author last updated @value{UPDATED} 36c19800e8SDoug Rabson 37c19800e8SDoug Rabson@def@copynext{@vskip 20pt plus 1fil@penalty-1000} 38c19800e8SDoug Rabson@def@copyrightstart{} 39c19800e8SDoug Rabson@def@copyrightend{} 40c19800e8SDoug Rabson@page 41c19800e8SDoug Rabson@copyrightstart 42c19800e8SDoug RabsonCopyright (c) 1994-2007 Kungliga Tekniska H�gskolan 43c19800e8SDoug Rabson(Royal Institute of Technology, Stockholm, Sweden). 44c19800e8SDoug RabsonAll rights reserved. 45c19800e8SDoug Rabson 46c19800e8SDoug RabsonRedistribution and use in source and binary forms, with or without 47c19800e8SDoug Rabsonmodification, are permitted provided that the following conditions 48c19800e8SDoug Rabsonare met: 49c19800e8SDoug Rabson 50c19800e8SDoug Rabson1. Redistributions of source code must retain the above copyright 51c19800e8SDoug Rabson notice, this list of conditions and the following disclaimer. 52c19800e8SDoug Rabson 53c19800e8SDoug Rabson2. Redistributions in binary form must reproduce the above copyright 54c19800e8SDoug Rabson notice, this list of conditions and the following disclaimer in the 55c19800e8SDoug Rabson documentation and/or other materials provided with the distribution. 56c19800e8SDoug Rabson 57c19800e8SDoug Rabson3. Neither the name of the Institute nor the names of its contributors 58c19800e8SDoug Rabson may be used to endorse or promote products derived from this software 59c19800e8SDoug Rabson without specific prior written permission. 60c19800e8SDoug Rabson 61c19800e8SDoug RabsonTHIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 62c19800e8SDoug RabsonANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 63c19800e8SDoug RabsonIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 64c19800e8SDoug RabsonARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 65c19800e8SDoug RabsonFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 66c19800e8SDoug RabsonDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 67c19800e8SDoug RabsonOR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 68c19800e8SDoug RabsonHOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 69c19800e8SDoug RabsonLIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 70c19800e8SDoug RabsonOUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 71c19800e8SDoug RabsonSUCH DAMAGE. 72c19800e8SDoug Rabson 73c19800e8SDoug Rabson@copynext 74c19800e8SDoug Rabson 75c19800e8SDoug RabsonCopyright (C) 1990 by the Massachusetts Institute of Technology 76c19800e8SDoug Rabson 77c19800e8SDoug RabsonExport of this software from the United States of America may 78c19800e8SDoug Rabsonrequire a specific license from the United States Government. 79c19800e8SDoug RabsonIt is the responsibility of any person or organization contemplating 80c19800e8SDoug Rabsonexport to obtain such a license before exporting. 81c19800e8SDoug Rabson 82c19800e8SDoug RabsonWITHIN THAT CONSTRAINT, permission to use, copy, modify, and 83c19800e8SDoug Rabsondistribute this software and its documentation for any purpose and 84c19800e8SDoug Rabsonwithout fee is hereby granted, provided that the above copyright 85c19800e8SDoug Rabsonnotice appear in all copies and that both that copyright notice and 86c19800e8SDoug Rabsonthis permission notice appear in supporting documentation, and that 87c19800e8SDoug Rabsonthe name of M.I.T. not be used in advertising or publicity pertaining 88c19800e8SDoug Rabsonto distribution of the software without specific, written prior 89c19800e8SDoug Rabsonpermission. M.I.T. makes no representations about the suitability of 90c19800e8SDoug Rabsonthis software for any purpose. It is provided "as is" without express 91c19800e8SDoug Rabsonor implied warranty. 92c19800e8SDoug Rabson 93c19800e8SDoug Rabson@copynext 94c19800e8SDoug Rabson 95c19800e8SDoug RabsonCopyright (c) 1988, 1990, 1993 96c19800e8SDoug Rabson The Regents of the University of California. All rights reserved. 97c19800e8SDoug Rabson 98c19800e8SDoug RabsonRedistribution and use in source and binary forms, with or without 99c19800e8SDoug Rabsonmodification, are permitted provided that the following conditions 100c19800e8SDoug Rabsonare met: 101c19800e8SDoug Rabson 102c19800e8SDoug Rabson1. Redistributions of source code must retain the above copyright 103c19800e8SDoug Rabson notice, this list of conditions and the following disclaimer. 104c19800e8SDoug Rabson 105c19800e8SDoug Rabson2. Redistributions in binary form must reproduce the above copyright 106c19800e8SDoug Rabson notice, this list of conditions and the following disclaimer in the 107c19800e8SDoug Rabson documentation and/or other materials provided with the distribution. 108c19800e8SDoug Rabson 109c19800e8SDoug Rabson3. Neither the name of the University nor the names of its contributors 110c19800e8SDoug Rabson may be used to endorse or promote products derived from this software 111c19800e8SDoug Rabson without specific prior written permission. 112c19800e8SDoug Rabson 113c19800e8SDoug RabsonTHIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 114c19800e8SDoug RabsonANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 115c19800e8SDoug RabsonIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 116c19800e8SDoug RabsonARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 117c19800e8SDoug RabsonFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 118c19800e8SDoug RabsonDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 119c19800e8SDoug RabsonOR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 120c19800e8SDoug RabsonHOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 121c19800e8SDoug RabsonLIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 122c19800e8SDoug RabsonOUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 123c19800e8SDoug RabsonSUCH DAMAGE. 124c19800e8SDoug Rabson 125c19800e8SDoug Rabson@copynext 126c19800e8SDoug Rabson 127c19800e8SDoug RabsonCopyright 1992 Simmule Turner and Rich Salz. All rights reserved. 128c19800e8SDoug Rabson 129c19800e8SDoug RabsonThis software is not subject to any license of the American Telephone 130c19800e8SDoug Rabsonand Telegraph Company or of the Regents of the University of California. 131c19800e8SDoug Rabson 132c19800e8SDoug RabsonPermission is granted to anyone to use this software for any purpose on 133c19800e8SDoug Rabsonany computer system, and to alter it and redistribute it freely, subject 134c19800e8SDoug Rabsonto the following restrictions: 135c19800e8SDoug Rabson 136c19800e8SDoug Rabson1. The authors are not responsible for the consequences of use of this 137c19800e8SDoug Rabson software, no matter how awful, even if they arise from flaws in it. 138c19800e8SDoug Rabson 139c19800e8SDoug Rabson2. The origin of this software must not be misrepresented, either by 140c19800e8SDoug Rabson explicit claim or by omission. Since few users ever read sources, 141c19800e8SDoug Rabson credits must appear in the documentation. 142c19800e8SDoug Rabson 143c19800e8SDoug Rabson3. Altered versions must be plainly marked as such, and must not be 144c19800e8SDoug Rabson misrepresented as being the original software. Since few users 145c19800e8SDoug Rabson ever read sources, credits must appear in the documentation. 146c19800e8SDoug Rabson 147c19800e8SDoug Rabson4. This notice may not be removed or altered. 148c19800e8SDoug Rabson 149c19800e8SDoug Rabson@copynext 150c19800e8SDoug Rabson 151c19800e8SDoug RabsonIMath is Copyright 2002-2005 Michael J. Fromberger 152c19800e8SDoug RabsonYou may use it subject to the following Licensing Terms: 153c19800e8SDoug Rabson 154c19800e8SDoug RabsonPermission is hereby granted, free of charge, to any person obtaining 155c19800e8SDoug Rabsona copy of this software and associated documentation files (the 156c19800e8SDoug Rabson"Software"), to deal in the Software without restriction, including 157c19800e8SDoug Rabsonwithout limitation the rights to use, copy, modify, merge, publish, 158c19800e8SDoug Rabsondistribute, sublicense, and/or sell copies of the Software, and to 159c19800e8SDoug Rabsonpermit persons to whom the Software is furnished to do so, subject to 160c19800e8SDoug Rabsonthe following conditions: 161c19800e8SDoug Rabson 162c19800e8SDoug RabsonThe above copyright notice and this permission notice shall be 163c19800e8SDoug Rabsonincluded in all copies or substantial portions of the Software. 164c19800e8SDoug Rabson 165c19800e8SDoug RabsonTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 166c19800e8SDoug RabsonEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 167c19800e8SDoug RabsonMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 168c19800e8SDoug RabsonIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 169c19800e8SDoug RabsonCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 170c19800e8SDoug RabsonTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 171c19800e8SDoug RabsonSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 172c19800e8SDoug Rabson 173c19800e8SDoug Rabson@copyrightend 174c19800e8SDoug Rabson@end titlepage 175c19800e8SDoug Rabson 176c19800e8SDoug Rabson@macro manpage{man, section} 177c19800e8SDoug Rabson@cite{\man\(\section\)} 178c19800e8SDoug Rabson@end macro 179c19800e8SDoug Rabson 180c19800e8SDoug Rabson@c Less filling! Tastes great! 181c19800e8SDoug Rabson@iftex 182c19800e8SDoug Rabson@parindent=0pt 183c19800e8SDoug Rabson@global@parskip 6pt plus 1pt 184c19800e8SDoug Rabson@global@chapheadingskip = 15pt plus 4pt minus 2pt 185c19800e8SDoug Rabson@global@secheadingskip = 12pt plus 3pt minus 2pt 186c19800e8SDoug Rabson@global@subsecheadingskip = 9pt plus 2pt minus 2pt 187c19800e8SDoug Rabson@end iftex 188c19800e8SDoug Rabson@ifinfo 189c19800e8SDoug Rabson@paragraphindent 0 190c19800e8SDoug Rabson@end ifinfo 191c19800e8SDoug Rabson 192c19800e8SDoug Rabson@ifnottex 193c19800e8SDoug Rabson@node Top, Introduction, (dir), (dir) 194c19800e8SDoug Rabson@top Heimdal 195c19800e8SDoug Rabson@end ifnottex 196c19800e8SDoug Rabson 197c19800e8SDoug RabsonThis manual is last updated @value{UPDATED} for version 198c19800e8SDoug Rabson@value{VERSION} of hx509. 199c19800e8SDoug Rabson 200c19800e8SDoug Rabson@menu 201c19800e8SDoug Rabson* Introduction:: 202c19800e8SDoug Rabson* What is X.509 ?:: 203c19800e8SDoug Rabson* Setting up a CA:: 204c19800e8SDoug Rabson* CMS signing and encryption:: 205c19800e8SDoug Rabson 206c19800e8SDoug Rabson@detailmenu 207c19800e8SDoug Rabson --- The Detailed Node Listing --- 208c19800e8SDoug Rabson 209c19800e8SDoug RabsonSetting up a CA 210c19800e8SDoug Rabson 211c19800e8SDoug Rabson@c * Issuing certificates:: 212c19800e8SDoug Rabson* Creating a CA certificate:: 213c19800e8SDoug Rabson* Issuing certificates:: 214c19800e8SDoug Rabson* Issuing CRLs:: 215c19800e8SDoug Rabson@c * Issuing a proxy certificate:: 216c19800e8SDoug Rabson@c * Creating a user certificate:: 217c19800e8SDoug Rabson@c * Validating a certificate:: 218c19800e8SDoug Rabson@c * Validating a certificate path:: 219c19800e8SDoug Rabson* Application requirements:: 220c19800e8SDoug Rabson 221c19800e8SDoug RabsonCMS signing and encryption 222c19800e8SDoug Rabson 223c19800e8SDoug Rabson* CMS background:: 224c19800e8SDoug Rabson 225c19800e8SDoug Rabson@end detailmenu 226c19800e8SDoug Rabson@end menu 227c19800e8SDoug Rabson 228c19800e8SDoug Rabson@node Introduction, What is X.509 ?, Top, Top 229c19800e8SDoug Rabson@chapter Introduction 230c19800e8SDoug Rabson 231c19800e8SDoug Rabsonhx509 is a somewhat complete X.509 stack that can handle CMS messages 232c19800e8SDoug Rabson(crypto system used in S/MIME and Kerberos PK-INIT) and basic 233c19800e8SDoug Rabsoncertificate processing tasks, path construction, path validation, OCSP 234c19800e8SDoug Rabsonand CRL validation, PKCS10 message construction, CMS Encrypted (shared 235c19800e8SDoug Rabsonsecret encrypted), CMS SignedData (certificate signed), and CMS 236c19800e8SDoug RabsonEnvelopedData (certificate encrypted). 237c19800e8SDoug Rabson 238c19800e8SDoug Rabsonhx509 can use PKCS11 tokens, PKCS12 files, PEM files, DER encoded files. 239c19800e8SDoug Rabson 240c19800e8SDoug Rabson@node What is X.509 ?, Setting up a CA, Introduction, Top 241c19800e8SDoug Rabson@chapter What is X.509, PKIX, PKCS7 and CMS ? 242c19800e8SDoug Rabson 243c19800e8SDoug RabsonX.509 is from the beginning created by CCITT (later ITU) for the X.500 244c19800e8SDoug Rabsondirectory service. But today when people are talking about X.509 they 245c19800e8SDoug Rabsonare commonly referring to IETF's PKIX Certificate and CRL Profile of the 246c19800e8SDoug RabsonX.509 v3 certificate standard, as specified in RFC 3280. 247c19800e8SDoug Rabson 248c19800e8SDoug RabsonITU continues to develop the X.509 standard together in a complicated 249c19800e8SDoug Rabsondance with IETF. 250c19800e8SDoug Rabson 251c19800e8SDoug RabsonX.509 is public key based security system that have associated data 252c19800e8SDoug Rabsonstored within a so called certificate. From the beginning X.509 was a 253c19800e8SDoug Rabsonstrict hierarchical system with one root. This didn't not work so over 254c19800e8SDoug Rabsontime X.509 got support for multiple policy roots, bridges, and mesh 255c19800e8SDoug Rabsonsolutions. You can even use it as a peer to peer system, but this is not 256c19800e8SDoug Rabsonvery common. 257c19800e8SDoug Rabson 258c19800e8SDoug Rabson@section Type of certificates 259c19800e8SDoug Rabson 260c19800e8SDoug RabsonThere are several flavors of certificate in X.509. 261c19800e8SDoug Rabson 262c19800e8SDoug Rabson@itemize @bullet 263c19800e8SDoug Rabson 264c19800e8SDoug Rabson@item Trust anchors 265c19800e8SDoug Rabson 266c19800e8SDoug RabsonTrust anchors are strictly not certificate, but commonly stored in 267c19800e8SDoug Rabsoncertificate since they are easier to handle then. Trust anchor are the 268c19800e8SDoug Rabsonkeys that you trust to validate other certificate. This is done by 269c19800e8SDoug Rabsonbuilding a path from the certificate you wan to validate to to any of 270c19800e8SDoug Rabsonthe trust anchors you have. 271c19800e8SDoug Rabson 272c19800e8SDoug Rabson@item End Entity (EE) certificates 273c19800e8SDoug Rabson 274c19800e8SDoug RabsonEnd entity certificates is the most common type of certificate. End 275c19800e8SDoug Rabsonentity certificates can't issue certificate them-self and is used to 276c19800e8SDoug Rabsonauthenticate and authorize user and services. 277c19800e8SDoug Rabson 278c19800e8SDoug Rabson@item Certification Authority (CA) certificates 279c19800e8SDoug Rabson 280c19800e8SDoug RabsonCertificate authority are certificates that have the right to issue 281c19800e8SDoug Rabsonother certificate, they may be End entity certificates or Certificate 282c19800e8SDoug RabsonAuthority certificates. There is no limit to how many certificates a CA 283c19800e8SDoug Rabsonmay issue, but there might other restrictions, like the maximum path 284c19800e8SDoug Rabsondepth. 285c19800e8SDoug Rabson 286c19800e8SDoug Rabson@item Proxy certificates 287c19800e8SDoug Rabson 288c19800e8SDoug RabsonRemember that End Entity can't issue certificates by them own, it's not 289c19800e8SDoug Rabsonreally true. There there is an extension called proxy certificates, 290c19800e8SDoug Rabsondefined in RFC3820, that allows certificates to be issued by end entity 291c19800e8SDoug Rabsoncertificates. The service that receives the proxy certificates must have 292c19800e8SDoug Rabsonexplicitly turned on support for proxy certificates, so their use is 293c19800e8SDoug Rabsonsomewhat limited. 294c19800e8SDoug Rabson 295c19800e8SDoug RabsonProxy certificates can be limited by policy stored in the certificate to 296c19800e8SDoug Rabsonwhat they can be used for. This allows users to delegate the proxy 297c19800e8SDoug Rabsoncertificate to services (by sending over the certificate and private 298c19800e8SDoug Rabsonkey) so the service can access services on behalf of the user. 299c19800e8SDoug Rabson 300c19800e8SDoug RabsonOne example of this would be a print service. The user wants to print a 301c19800e8SDoug Rabsonlarge job in the middle of the night when the printer isn't used that 302c19800e8SDoug Rabsonmuch, so the user creates a proxy certificate with the policy that it 303c19800e8SDoug Rabsoncan only be used to access files related to this print job, creates the 304c19800e8SDoug Rabsonprint job description and send both the description and proxy 305c19800e8SDoug Rabsoncertificate with key over to print service. Later at night will the 306c19800e8SDoug Rabsonprint service, without the help of the user, access the files for the 307c19800e8SDoug Rabsonthe print job using the proxy certificate and print the job. Because of 308c19800e8SDoug Rabsonthe policy (limitation) in the proxy certificate, it can't be used for 309c19800e8SDoug Rabsonany other purposes. 310c19800e8SDoug Rabson 311c19800e8SDoug Rabson@end itemize 312c19800e8SDoug Rabson 313c19800e8SDoug Rabson@section Building a path 314c19800e8SDoug Rabson 315c19800e8SDoug RabsonBefore validating a path the path must be constructed. Given a 316c19800e8SDoug Rabsoncertificate (EE, CA, Proxy, or any other type), the path construction 317c19800e8SDoug Rabsonalgorithm will try to find a path to one of the trust anchors. 318c19800e8SDoug Rabson 319c19800e8SDoug RabsonIt start with looking at whom issued the certificate, by name or Key 320c19800e8SDoug RabsonIdentifier, and tries to find that certificate while at the same time 321c19800e8SDoug Rabsonevaluates the policy. 322c19800e8SDoug Rabson 323c19800e8SDoug Rabson@node Setting up a CA, Creating a CA certificate, What is X.509 ?, Top 324c19800e8SDoug Rabson@chapter Setting up a CA 325c19800e8SDoug Rabson 326c19800e8SDoug RabsonDo not let this chapter scare you off, it's just to give you an idea how 327c19800e8SDoug Rabsonto complicated setting up a CA can be. If you are just playing around, 328c19800e8SDoug Rabsonskip all this and go to the next chapter, @pxref{Creating a CA 329c19800e8SDoug Rabsoncertificate}. 330c19800e8SDoug Rabson 331c19800e8SDoug RabsonCreating a CA certificate should be more the just creating a 332c19800e8SDoug Rabsoncertificate, there is the policy of the CA. If it's just you and your 333c19800e8SDoug Rabsonfriend that is playing around then it probably doesn't matter what the 334c19800e8SDoug Rabsonpolicy is. But then it comes to trust in an organisation, it will 335c19800e8SDoug Rabsonprobably matter more whom your users and sysadmins will find it 336c19800e8SDoug Rabsonacceptable to trust. 337c19800e8SDoug Rabson 338c19800e8SDoug RabsonAt the same time, try to keep thing simple, it's not very hard to run a 339c19800e8SDoug RabsonCertificate authority and the process to get new certificates should 340c19800e8SDoug Rabsonsimple. 341c19800e8SDoug Rabson 342c19800e8SDoug RabsonFill all this in later. 343c19800e8SDoug Rabson 344c19800e8SDoug RabsonHow do you trust your CA. 345c19800e8SDoug Rabson 346c19800e8SDoug RabsonWhat is the CA responsibility. 347c19800e8SDoug Rabson 348c19800e8SDoug RabsonReview of CA activity. 349c19800e8SDoug Rabson 350c19800e8SDoug RabsonHow much process should it be to issue certificate. 351c19800e8SDoug Rabson 352c19800e8SDoug RabsonWho is allowed to issue certificates. 353c19800e8SDoug Rabson 354c19800e8SDoug RabsonWho is allowed to requests certificates. 355c19800e8SDoug Rabson 356c19800e8SDoug RabsonHow to handle certificate revocation, issuing CRLs and maintain OCSP 357c19800e8SDoug Rabsonservices. 358c19800e8SDoug Rabson 359c19800e8SDoug Rabson@node Creating a CA certificate, Issuing certificates, Setting up a CA, Top 360c19800e8SDoug Rabson@section Creating a CA certificate 361c19800e8SDoug Rabson 362c19800e8SDoug RabsonThis section describes how to create a CA certificate and what to think 363c19800e8SDoug Rabsonabout. 364c19800e8SDoug Rabson 365c19800e8SDoug Rabson@subsection Lifetime CA certificate 366c19800e8SDoug Rabson 367c19800e8SDoug RabsonYou probably want to create a CA certificate with a long lifetime, 10 368c19800e8SDoug Rabsonyears at the shortest. This because you don't want to push out the 369c19800e8SDoug Rabsoncertificate (as a trust anchor) to all you users once again when the old 370c19800e8SDoug Rabsonone just expired. A trust anchor can't really expire, but not all 371c19800e8SDoug Rabsonsoftware works that way. 372c19800e8SDoug Rabson 373c19800e8SDoug RabsonKeep in mind the security requirements might be different 10-20 years 374c19800e8SDoug Rabsoninto the future. For example, SHA1 is going to be withdrawn in 2010, so 375c19800e8SDoug Rabsonmake sure you have enough buffering in your choice of digest/hash 376c19800e8SDoug Rabsonalgorithms, signature algorithms and key lengths. 377c19800e8SDoug Rabson 378c19800e8SDoug Rabson@subsection Create a CA certificate 379c19800e8SDoug Rabson 380c19800e8SDoug RabsonThis command below will create a CA certificate in the file ca.pem. 381c19800e8SDoug Rabson 382c19800e8SDoug Rabson@example 383c19800e8SDoug Rabsonhxtool issue-certificate \ 384c19800e8SDoug Rabson --self-signed \ 385c19800e8SDoug Rabson --issue-ca \ 386c19800e8SDoug Rabson --generate-key=rsa \ 387c19800e8SDoug Rabson --subject="CN=CertificateAuthority,DC=test,DC=h5l,DC=se" \ 388c19800e8SDoug Rabson --lifetime=10years \ 389c19800e8SDoug Rabson --certificate="FILE:ca.pem" 390c19800e8SDoug Rabson@end example 391c19800e8SDoug Rabson 392c19800e8SDoug Rabson@subsection Extending lifetime of a CA certificate 393c19800e8SDoug Rabson 394c19800e8SDoug RabsonYou just realised that your CA certificate is going to expire soon and 395c19800e8SDoug Rabsonthat you need replace it with something else, the easiest way to do that 396c19800e8SDoug Rabsonis to extend the lifetime of your CA certificate. 397c19800e8SDoug Rabson 398c19800e8SDoug RabsonThe example below will extend the CA certificate 10 years into the 399c19800e8SDoug Rabsonfuture. You should compare this new certificate if it contains all the 400c19800e8SDoug Rabsonspecial tweaks as the old certificate had. 401c19800e8SDoug Rabson 402c19800e8SDoug Rabson@example 403c19800e8SDoug Rabsonhxtool issue-certificate \ 404c19800e8SDoug Rabson --self-signed \ 405c19800e8SDoug Rabson --issue-ca \ 406c19800e8SDoug Rabson --lifetime="10years" \ 407c19800e8SDoug Rabson --template-certificate="FILE:ca.pem" \ 408c19800e8SDoug Rabson --template-fields="serialNumber,notBefore,subject,SPKI" \ 409c19800e8SDoug Rabson --ca-private-key=FILE:ca.pem \ 410c19800e8SDoug Rabson --certificate="FILE:new-ca.pem" 411c19800e8SDoug Rabson@end example 412c19800e8SDoug Rabson 413c19800e8SDoug Rabson@subsection Subordinate CA 414c19800e8SDoug Rabson 415c19800e8SDoug RabsonThis example create a new subordinate certificate authority. 416c19800e8SDoug Rabson 417c19800e8SDoug Rabson@example 418c19800e8SDoug Rabsonhxtool issue-certificate \ 419c19800e8SDoug Rabson --ca-certificate=FILE:ca.pem \ 420c19800e8SDoug Rabson --issue-ca \ 421c19800e8SDoug Rabson --generate-key=rsa \ 422c19800e8SDoug Rabson --subject="CN=CertificateAuthority,DC=dev,DC=test,DC=h5l,DC=se" \ 423c19800e8SDoug Rabson --certificate="FILE:dev-ca.pem" 424c19800e8SDoug Rabson@end example 425c19800e8SDoug Rabson 426c19800e8SDoug Rabson 427c19800e8SDoug Rabson@node Issuing certificates, Issuing CRLs, Creating a CA certificate, Top 428c19800e8SDoug Rabson@section Issuing certificates 429c19800e8SDoug Rabson 430c19800e8SDoug RabsonFirst you'll create a CA certificate, after that you have to deal with 431c19800e8SDoug Rabsonyour users and servers and issue certificate to them. 432c19800e8SDoug Rabson 433c19800e8SDoug RabsonCA can generate the key for the user. 434c19800e8SDoug Rabson 435c19800e8SDoug RabsonCan receive PKCS10 certificate requests from the users. PKCS10 is a 436c19800e8SDoug Rabsonrequest for a certificate. The user can specified what DN the user wants 437c19800e8SDoug Rabsonand what public key. To prove the user have the key, the whole request 438c19800e8SDoug Rabsonis signed by the private key of the user. 439c19800e8SDoug Rabson 440c19800e8SDoug Rabson@subsection Name space management 441c19800e8SDoug Rabson 442c19800e8SDoug RabsonWhat people might want to see. 443c19800e8SDoug Rabson 444c19800e8SDoug RabsonRe-issue certificates just because people moved within the organization. 445c19800e8SDoug Rabson 446c19800e8SDoug RabsonExpose privacy information. 447c19800e8SDoug Rabson 448c19800e8SDoug RabsonUsing Sub-component name (+ notation). 449c19800e8SDoug Rabson 450c19800e8SDoug Rabson@subsection Certificate Revocation, CRL and OCSP 451c19800e8SDoug Rabson 452c19800e8SDoug RabsonSonetimes people loose smartcard or computers and certificates have to 453c19800e8SDoug Rabsonbe make not valid any more, this is called revoking certificates. There 454c19800e8SDoug Rabsonare two main protocols for doing this Certificate Revocations Lists 455c19800e8SDoug Rabson(CRL) and Online Certificate Status Protocol (OCSP). 456c19800e8SDoug Rabson 457c19800e8SDoug RabsonIf you know that the certificate is destroyed then there is no need to 458c19800e8SDoug Rabsonrevoke the certificate because it can not be used by someone else. 459c19800e8SDoug Rabson 460c19800e8SDoug RabsonThe main reason you as a CA administrator have to deal with CRLs however 461c19800e8SDoug Rabsonwill be that some software require there to be CRLs. Example of this is 462c19800e8SDoug RabsonWindows, so you have to deal with this somehow. 463c19800e8SDoug Rabson 464c19800e8SDoug Rabson@node Issuing CRLs, Application requirements, Issuing certificates, Top 465c19800e8SDoug Rabson@section Issuing CRLs 466c19800e8SDoug Rabson 467c19800e8SDoug RabsonCreate an empty CRL with not certificates revoked. Default expiration 468c19800e8SDoug Rabsonvalue is one year from now. 469c19800e8SDoug Rabson 470c19800e8SDoug Rabson@example 471c19800e8SDoug Rabsonhxtool crl-sign \ 472c19800e8SDoug Rabson --crl-file=crl.der \ 473c19800e8SDoug Rabson --signer=FILE:ca.pem 474c19800e8SDoug Rabson@end example 475c19800e8SDoug Rabson 476c19800e8SDoug RabsonCreate a CRL with all certificates in the directory 477c19800e8SDoug Rabson@file{/path/to/revoked/dir} included in the CRL as revoked. Also make 478c19800e8SDoug Rabsonit expire one month from now. 479c19800e8SDoug Rabson 480c19800e8SDoug Rabson@example 481c19800e8SDoug Rabsonhxtool crl-sign \ 482c19800e8SDoug Rabson --crl-file=crl.der \ 483c19800e8SDoug Rabson --signer=FILE:ca.pem \ 484c19800e8SDoug Rabson --lifetime='1 month' \ 485c19800e8SDoug Rabson DIR:/path/to/revoked/dir 486c19800e8SDoug Rabson@end example 487c19800e8SDoug Rabson 488c19800e8SDoug Rabson@node Application requirements, CMS signing and encryption, Issuing CRLs, Top 489c19800e8SDoug Rabson@section Application requirements 490c19800e8SDoug Rabson 491c19800e8SDoug RabsonApplication have different requirements on certificates. This section 492c19800e8SDoug Rabsontries to expand what they are and how to use hxtool to generate 493c19800e8SDoug Rabsoncertificates for those services. 494c19800e8SDoug Rabson 495c19800e8SDoug Rabson@subsection HTTPS - server 496c19800e8SDoug Rabson 497c19800e8SDoug Rabson@example 498c19800e8SDoug Rabsonhxtool issue-certificate \ 499c19800e8SDoug Rabson --subject="CN=www.test.h5l.se,DC=test,DC=h5l,DC=se" \ 500c19800e8SDoug Rabson --type="https-server" \ 501c19800e8SDoug Rabson --hostname="www.test.h5l.se" \ 502c19800e8SDoug Rabson --hostname="www2.test.h5l.se" \ 503c19800e8SDoug Rabson ... 504c19800e8SDoug Rabson@end example 505c19800e8SDoug Rabson 506c19800e8SDoug Rabson@subsection HTTPS - client 507c19800e8SDoug Rabson 508c19800e8SDoug Rabson@example 509c19800e8SDoug Rabsonhxtool issue-certificate \ 510c19800e8SDoug Rabson --subject="UID=testus,DC=test,DC=h5l,DC=se" \ 511c19800e8SDoug Rabson --type="https-client" \ 512c19800e8SDoug Rabson ... 513c19800e8SDoug Rabson@end example 514c19800e8SDoug Rabson 515c19800e8SDoug Rabson@subsection S/MIME - email 516c19800e8SDoug Rabson 517c19800e8SDoug RabsonThere are two things that should be set in S/MIME certificates, one or 518c19800e8SDoug Rabsonmore email addresses and an extended eku usage (EKU), emailProtection. 519c19800e8SDoug Rabson 520c19800e8SDoug RabsonThe email address format used in S/MIME certificates is defined in 521c19800e8SDoug RabsonRFC2822, section 3.4.1 and it should be an ``addr-spec''. 522c19800e8SDoug Rabson 523c19800e8SDoug RabsonThere are two ways to specifify email address in certificates. The old 524c19800e8SDoug Rabsonways is in the subject distinguished name, this should not be used. The 525c19800e8SDoug Rabsonnew way is using a Subject Alternative Name (SAN). 526c19800e8SDoug Rabson 527c19800e8SDoug RabsonBut even though email address is stored in certificates, they don't need 528c19800e8SDoug Rabsonto, email reader programs are required to accept certificates that 529c19800e8SDoug Rabsondoesn't have either of the two methods of storing email in certificates. 530c19800e8SDoug RabsonIn that case, they try to protect the user by printing the name of the 531c19800e8SDoug Rabsoncertificate instead. 532c19800e8SDoug Rabson 533c19800e8SDoug RabsonS/MIME certificate can be used in another special way. They can be 534c19800e8SDoug Rabsonissued with a NULL subject distinguished name plus the email in SAN, 535c19800e8SDoug Rabsonthis is a valid certificate. This is used when you wont want to share 536c19800e8SDoug Rabsonmore information then you need to. 537c19800e8SDoug Rabson 538c19800e8SDoug Rabsonhx509 issue-certificate supports adding the email SAN to certificate by 539c19800e8SDoug Rabsonusing the --email option, --email also gives an implicit emailProtection 540c19800e8SDoug Rabsoneku. If you want to create an certificate without an email address, the 541c19800e8SDoug Rabsonoption --type=email will add the emailProtection EKU. 542c19800e8SDoug Rabson 543c19800e8SDoug Rabson@example 544c19800e8SDoug Rabsonhxtool issue-certificate \ 545c19800e8SDoug Rabson --subject="UID=testus-email,DC=test,DC=h5l,DC=se" \ 546c19800e8SDoug Rabson --type=email \ 547c19800e8SDoug Rabson --email="testus@@test.h5l.se" \ 548c19800e8SDoug Rabson ... 549c19800e8SDoug Rabson@end example 550c19800e8SDoug Rabson 551c19800e8SDoug RabsonAn example of an certificate without and subject distinguished name with 552c19800e8SDoug Rabsonan email address in a SAN. 553c19800e8SDoug Rabson 554c19800e8SDoug Rabson@example 555c19800e8SDoug Rabsonhxtool issue-certificate \ 556c19800e8SDoug Rabson --subject="" \ 557c19800e8SDoug Rabson --type=email \ 558c19800e8SDoug Rabson --email="testus@@test.h5l.se" \ 559c19800e8SDoug Rabson ... 560c19800e8SDoug Rabson@end example 561c19800e8SDoug Rabson 562c19800e8SDoug Rabson@subsection PK-INIT 563c19800e8SDoug Rabson 564c19800e8SDoug RabsonHow to create a certificate for a KDC. 565c19800e8SDoug Rabson 566c19800e8SDoug Rabson@example 567c19800e8SDoug Rabsonhxtool issue-certificate \ 568c19800e8SDoug Rabson --type="pkinit-kdc" \ 569c19800e8SDoug Rabson --pk-init-principal="krbtgt/TEST.H5L.SE@@TEST.H5L.SE" \ 570c19800e8SDoug Rabson --hostname kerberos.test.h5l.se \ 571c19800e8SDoug Rabson --hostname pal.test.h5l.se \ 572c19800e8SDoug Rabson ... 573c19800e8SDoug Rabson@end example 574c19800e8SDoug Rabson 575c19800e8SDoug RabsonHow to create a certificate for a user. 576c19800e8SDoug Rabson 577c19800e8SDoug Rabson@example 578c19800e8SDoug Rabsonhxtool issue-certificate \ 579c19800e8SDoug Rabson --type="pkinit-client" \ 580c19800e8SDoug Rabson --pk-init-principal="user@@TEST.H5L.SE" \ 581c19800e8SDoug Rabson ... 582c19800e8SDoug Rabson@end example 583c19800e8SDoug Rabson 584c19800e8SDoug Rabson@subsection XMPP/Jabber 585c19800e8SDoug Rabson 586c19800e8SDoug RabsonThe jabber server certificate should have a dNSname that is the same as 587c19800e8SDoug Rabsonthe user entered into the application, not the same as the host name of 588c19800e8SDoug Rabsonthe machine. 589c19800e8SDoug Rabson 590c19800e8SDoug Rabson@example 591c19800e8SDoug Rabsonhxtool issue-certificate \ 592c19800e8SDoug Rabson --subject="CN=xmpp1.test.h5l.se,DC=test,DC=h5l,DC=se" \ 593c19800e8SDoug Rabson --hostname="xmpp1.test.h5l.se" \ 594c19800e8SDoug Rabson --hostname="test.h5l.se" \ 595c19800e8SDoug Rabson ... 596c19800e8SDoug Rabson@end example 597c19800e8SDoug Rabson 598c19800e8SDoug RabsonThe certificate may also contain a jabber identifier (JID) that, if the 599c19800e8SDoug Rabsonreceiver allows it, authorises the server or client to use that JID. 600c19800e8SDoug Rabson 601c19800e8SDoug RabsonWhen storing a JID inside the certificate, both for server and client, 602c19800e8SDoug Rabsonit's stored inside a UTF8String within an otherName entity inside the 603c19800e8SDoug RabsonsubjectAltName, using the OID id-on-xmppAddr (1.3.6.1.5.5.7.8.5). 604c19800e8SDoug Rabson 605c19800e8SDoug RabsonTo read more about the requirements, see RFC3920, Extensible Messaging 606c19800e8SDoug Rabsonand Presence Protocol (XMPP): Core. 607c19800e8SDoug Rabson 608c19800e8SDoug Rabsonhxtool issue-certificate have support to add jid to the certificate 609c19800e8SDoug Rabsonusing the option @kbd{--jid}. 610c19800e8SDoug Rabson 611c19800e8SDoug Rabson@example 612c19800e8SDoug Rabsonhxtool issue-certificate \ 613c19800e8SDoug Rabson --subject="CN=Love,DC=test,DC=h5l,DC=se" \ 614c19800e8SDoug Rabson --jid="lha@@test.h5l.se" \ 615c19800e8SDoug Rabson ... 616c19800e8SDoug Rabson@end example 617c19800e8SDoug Rabson 618c19800e8SDoug Rabson 619c19800e8SDoug Rabson@node CMS signing and encryption, CMS background, Application requirements, Top 620c19800e8SDoug Rabson@chapter CMS signing and encryption 621c19800e8SDoug Rabson 622c19800e8SDoug RabsonCMS is the Cryptographic Message System that among other, is used by 623c19800e8SDoug RabsonS/MIME (secure email) and Kerberos PK-INIT. It's an extended version of 624c19800e8SDoug Rabsonthe RSA, Inc standard PKCS7. 625c19800e8SDoug Rabson 626c19800e8SDoug Rabson@node CMS background, , CMS signing and encryption, Top 627c19800e8SDoug Rabson@section CMS background 628c19800e8SDoug Rabson 629c19800e8SDoug Rabson 630c19800e8SDoug Rabson@c @shortcontents 631c19800e8SDoug Rabson@contents 632c19800e8SDoug Rabson 633c19800e8SDoug Rabson@bye 634