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