1 This is /home/wk/s/libksba/doc/ksba.info, produced by makeinfo version
2 4.13 from /home/wk/s/libksba/doc/ksba.texi.
4 INFO-DIR-SECTION GNU libraries
6 * libksba: (ksba). An X.509 Library.
9 This file documents the KSBA library to access X.509 and CMS data
12 This is edition 1.3.1, last updated 15 March 2013, of `The KSBA
13 Reference Manual', for Version 1.3.1.
15 Copyright (C) 2002, 2003, 2004 g10 Code GmbH
17 Permission is granted to copy, distribute and/or modify this document
18 under the terms of the GNU General Public License as published by the
19 Free Software Foundation; either version 3 of the License, or (at your
20 option) any later version. The text of the license can be found in the
21 section entitled "Copying".
24 File: ksba.info, Node: Top, Next: Introduction, Up: (dir)
29 This is edition 1.3.1, last updated 15 March 2013, of `The KSBA
30 Reference Manual', for Version 1.3.1 of the KSBA library.
32 Copyright (C) 2002, 2003, 2004 g10 Code GmbH
34 Permission is granted to copy, distribute and/or modify this document
35 under the terms of the GNU General Public License as published by the
36 Free Software Foundation; either version 3 of the License, or (at your
37 option) any later version. The text of the license can be found in the
38 section entitled "Copying".
42 * Introduction:: How to use this manual.
43 * Preparation:: What you should do before using the library.
44 * Certificate Handling:: How to work with X.509 certificates.
45 * CMS:: How to work with CMS (PKCS#7) messages.
46 * CRLs:: How to work with Certificate Revocation Lists.
47 * PKCS10:: How to request certificates.
48 * Utilities:: Various utility functions.
49 * Error Handling:: Error numbers and their meanings.
53 * Component Labels:: Labels used in string representations.
54 * Copying:: The GNU General Public License says how you
55 can copy and share this manual.
59 * Concept Index:: Index of concepts and programs.
60 * Function and Data Index:: Index of functions, variables and data types.
62 --- The Detailed Node Listing ---
73 * Building the source::
77 * Creating certificates:: How to create a certificate object.
78 * Retrieving attributes:: How to get the attributes of a certificate.
79 * Setting attributes:: How to set certificates attributes.
80 * User data:: How to associate other data with a certificate.
82 Mastering the Cryptographic Message Syntax
88 File: ksba.info, Node: Introduction, Next: Preparation, Prev: Top, Up: Top
93 KSBA is a library to make the task of working with X.509 certificates,
94 CMS data and related data more easy.
103 File: ksba.info, Node: Getting Started, Next: Features, Up: Introduction
108 This manual documents the `KSBA' library programming interface. All
109 functions and data types provided by the library are explained.
111 The reader is assumed to possess basic knowledge about the
112 implemented protocols.
114 This manual can be used in several ways. If read from the beginning
115 to the end, it gives a good introduction into the library and how it
116 can be used in an application. Forward references are included where
117 necessary. Later on, the manual can be used as a reference manual to
118 get just the information needed about any particular interface of the
119 library. Experienced programmers might want to start looking at the
120 examples at the end of the manual, and then only read up those parts of
121 the interface which are unclear.
124 File: ksba.info, Node: Features, Next: Overview, Prev: Getting Started, Up: Introduction
129 `KSBA' has a couple of advantages over other libraries doing a similar
130 job, and over open coding the protocols in your application directly.
133 Anybody can use, modify, and redistribute it under the terms of
134 the GNU General Public License (*note Copying::).
136 It hides the low level stuff
137 `KSBA' a high level interface to the implemented protocols and
138 presents the data in a consistent way. There is no more need to
139 worry about all the nasty details of the protocols. The API gives
140 the C programmer a more usual way of interacting with the data.
142 It copes with the version details
143 X.509 protocols tend to have many different versions and dialects.
144 Applications must usually cope with all of this and it has to be
145 coded over and over again. `KSBA' hides this by providing just
146 one API which does the Right Thing. Support for new versions and
147 features of the protocols will be added over time.
150 File: ksba.info, Node: Overview, Prev: Features, Up: Introduction
155 The `KSBA' library is thread-safe as long as objects described by one
156 context are only used by one thread at a time. No initialization is
160 File: ksba.info, Node: Preparation, Next: Certificate Handling, Prev: Introduction, Up: Top
165 To use `KSBA', you have to perform some changes to your sources and the
166 build system. The necessary changes are small and explained in the
167 following sections. At the end of this chapter, it is described how the
168 library is initialized, and how the requirements of the library are
175 * Building the source::
178 File: ksba.info, Node: Header, Next: Version Check, Up: Preparation
183 All interfaces (data types and functions) of the library are defined in
184 the header file `ksba.h'. You must include this in all programs using
185 the library, either directly or through some other header file, like
190 The name space of `KSBA' is `ksba_*' for function names, `ksba*' for
191 data types and `KSBA_*' for other symbols. In addition the same name
192 prefixes with one prepended underscore are reserved for internal use
193 and should never be used by an application.
196 File: ksba.info, Node: Version Check, Next: Building the source, Prev: Header, Up: Preparation
201 It is often desirable to check that the version of `KSBA' used is indeed
202 one which fits all requirements. Even with binary compatibility, new
203 features may have been introduced but through peculiarities of the
204 runtime linker an old version gets actually used. So you better check
205 that the version is as expected right after program startup.
207 -- Function: const char * ksba_check_version (const char *REQ_VERSION)
208 Check that the the version of the library is at minimum the one
209 given as a string in REQ_VERSION and return the actual version
210 string of the library; return `NULL' if the condition is not met.
211 If `NULL' is passed to this function, no check is done and only the
212 version string is returned. It is a pretty good idea to run this
213 function as soon as possible, because it may also initializes some
214 subsystems. In a multi-threaded environment if should be called
215 before any more threads are created.
218 File: ksba.info, Node: Building the source, Prev: Version Check, Up: Preparation
220 2.3 Building the source
221 =======================
223 If you want to compile a source file including the `ksba.h' header
224 file, you must make sure that the compiler can find it in the directory
225 hierarchy. This is accomplished by adding the path to the directory in
226 which the header file is located to the compiler's include file search
227 path (via the `-I' option).
229 However, the path to the include file is determined at the time the
230 source is configured. To solve this problem, `KSBA' ships with a small
231 helper program `ksba-config' that knows about the path to the include
232 file and other configuration options. The options that need to be
233 added to the compiler invocation at compile time are output by the
234 `--cflags' option of `ksba-config'. The following example shows how it
235 can be used at the command line:
237 gcc -c foo.c `ksba-config --cflags`
239 Adding the output of `ksba-config --cflags' to the compiler's
240 command line will ensure that the compiler can find the `ksba.h' header
243 A similar problem occurs when linking the program with the library.
244 Again, the compiler has to find the library files. For this to work,
245 the path to the library files has to be added to the library search path
246 (via the `-L' option). For this, the option `--libs' of `ksba-config'
247 can be used. For convenience, this option also outputs all other
248 options that are required to link the program with the `KSBA' libraries
249 (in particular, the `-lksba' option). The example shows how to link
250 `foo.o' with the `KSBA' libraries to a program `foo'.
252 gcc -o foo foo.o `ksba-config --libs`
254 Of course you can also combine both examples to a single command by
255 specifying both options to `ksba-config':
257 gcc -o foo foo.c `ksba-config --cflags --libs`
260 File: ksba.info, Node: Certificate Handling, Next: CMS, Prev: Preparation, Up: Top
262 3 How to work with X.509 certificates.
263 **************************************
265 One of the most complex data formats are the X.509 certificates. KSBA
266 provides an easy to use interface to handle them.
268 -- Data type: ksba_cert_t
269 The `ksba_cert_t' type is a handle for an X.509 certificate.
271 -- Data type: ksba_sexp_t
272 The `ksba_sexp_t' type describes a canonically encoded S-expression
273 stored in a memory buffer. It is alias for `unsigned char *'.
274 Note that a length argument is not required because the length of
275 such an S-expression is intrinsically available.
279 * Creating certificates:: How to create a certificate object.
280 * Retrieving attributes:: How to get the attributes of a certificate.
281 * Setting attributes:: How to set certificates attributes.
282 * User data:: How to associate other data with a certificate.
285 File: ksba.info, Node: Creating certificates, Next: Retrieving attributes, Up: Certificate Handling
287 3.1 How to create a certificate object
288 ======================================
290 This section explains how to create a certificate object, initialize it,
291 copy it and eventually destroy it.
293 -- Function: ksba_cert_t ksba_cert_new (void)
294 The function `ksba_cert_new' creates a new certificate object and
295 returns a handle for it. The certificate object has initially one
298 The only reason why this function may fail is an out-of-memory
299 condition in which case `NULL' is returned. You might then get
300 the actual error code using `gpg_error_from_errno (errno)'.
302 -- Function: void ksba_cert_ref (ksba_cert_t CERT)
303 The function `ksba_cert_ref' bumps the reference counter of the
304 certificate object up by one. Thus an extra `ksba_cert_release' is
305 required to actually release the memory used for the object.
307 -- Function: void ksba_cert_release (ksba_cert_t CERT)
308 The function `ksba_cert_release' reduces the number of references
309 to the certificate object with the handle CERT. If this was the
310 last reference, it will also destroy the object and releases all
311 associated resources. It is okay to pass `NULL' to the function
312 in which case nothing happens.
314 -- Function: gpg_error_t ksba_cert_read_der (ksba_cert_t CERT,
315 ksba_reader_t READER)
316 Read the next certificate from the READER object and store it in
317 the certificate object CERT for future access. The certificate is
318 parsed and rejected if it has any syntactical or semantical error
319 (i.e. does not match the ASN.1 description).
321 The function returns `0' if the operation was successfully
322 performed. An error code is returned on failure.
324 -- Function: gpg_error_t ksba_cert_init_from_mem (ksba_cert_t CERT,
325 const void *BUFFER, size_t LENGTH)
326 Parse the BUFFER which should contain a DER encoded certificate of
327 LENGTH and initialize the certificate object CERT with it. This
328 function is intended as a convenience function to be used when a
329 certificate is already available in a internal memory buffer.
330 This avoids the extra code needed to setup the reader object.
331 Note that CERT must be a valid certificate object.
333 The function returns `0' if the operation was successfully
334 performed. An error code is returned on failure.
337 File: ksba.info, Node: Retrieving attributes, Next: Setting attributes, Prev: Creating certificates, Up: Certificate Handling
339 3.2 How to get the attributes of a certificate
340 ==============================================
342 The functions in this section allow accessing the attributes of a
343 certificate in a well defined manner. An error will be returned if the
344 certificate object has not yet been initialized by means of
345 `ksba_cert_read_der' or `ksba_cert_init_from_mem'.
347 -- Function: const unsigned char * ksba_cert_get_image
348 (ksba_cert_t CERT, size_t *R_LENGTH)
349 This function returns a pointer to the DER encoded buffer with the
350 raw certificate. The length of that buffer gets stored at
351 R_LENGTH. This function is useful to export or store the raw
354 The function returns `NULL' on error or a pointer to a buffer with
355 the raw certificate data. That pointer is only valid as long as
356 the certificate object CERT is valid and has not been
359 -- Function: gpg_error_t ksba_cert_hash (ksba_cert_t CERT, int WHAT,
360 void (*HASHER)(void *, const void *, size_t length),
362 This function feeds the data which is expected to be hashed into
363 the supplied function HASHER, where the first argument passed is
364 HASHER_ARG, the second the pointer to the data to be hashed and
365 the third the length of this data.
367 The function returns `0' on success or an error code when something
368 goes wrong. The HASHER function is not expected to return an
369 error; instead the caller should setup that function in a way to
370 convey encountered errors by means of the HASHER_ARG. Note that a
371 hash function is in general not expected to yield errors anyway.
373 -- Function: const char * ksba_cert_get_digest_algo (ksba_cert_t CERT)
374 Figure out the the digest algorithm used for the signature and
375 return its OID in dotted decimal format. This function is most
376 likely used to setup the hash context before calling
379 The function returns `NULL' for an error; on success a constant
380 string with the OID is returned. This string is valid as long the
381 certificate object is valid.
383 -- Function: ksba_sexp_t ksba_cert_get_serial (ksba_cert_t CERT)
384 The function returns the serial number of the certificate CERT.
385 The serial number is an integer returned as an canonical encoded
386 S-expression with just one element. The caller must free the
387 returned value. The value `NULL' is returned in case of error.
389 -- Function: char * ksba_cert_get_issuer (ksba_cert_t CERT, int IDX)
390 With IDX given as `0', this function returns the Distinguished
391 Name (DN) of the certificate issuer; this usually is the name of a
392 certification authority (CA). The format of the returned string
393 is in accordance with RFC-2253. `NULL' is returned if the DN is
394 not available; This is a severe error and actually should have
395 been caught by the certificate reading function.
397 With IDX greater than zero, the function may be used to enumerate
398 alternate issuer names. The function returns `NULL' when there are
399 no more alternate names. Only alternate names recognized by
400 `libksba' are returned, others are simply skipped. The format of
401 the returned name is either a RFC-2253 formated string which can be
402 detected by checking whether the first character is a letter or
403 digit. RFC-822 conformant email addresses are returned enclosed
404 in angle brackets; the opening angle bracket should be used to
405 detect this. Other formats are returned as an S-Expression in
406 canonical format, so a opening parenthesis should be used to
407 detect this encoding. The name may include binary null characters,
408 thus strlen may return a length shorter than actually used. The
409 real length is implicitly given by the structure of the
410 S-expression, an extra null is appended for safety reasons.
412 The caller must free the returned string using `ksba_free' or
413 whatever function has been registered as a replacement.
415 -- Function: char * ksba_cert_get_subject (ksba_cert_t CERT, int IDX)
416 With IDX given as `0', this function returns the Distinguished
417 Name (DN) of the certificate's subject. The format of the
418 returned string is in accordance with RFC-2253. `NULL' is
419 returned if the DN is not available.
421 With IDX greater than zero, the function may be used to enumerate
422 alternate subject names. The function returns `NULL' when there
423 are no more alternate names. Only alternate names recognized by
424 `libksba' are returned, others are simply skipped. The format of
425 the returned name is either a RFC-2253 formated string which can be
426 detected by checking whether the first character is a letter or
427 digit. RFC-2822 conform email addresses are returned enclosed in
428 angle brackets; the opening angle bracket should be used to detect
429 this. Other formats are returned as an S-Expression in canonical
430 format, so a opening parenthesis should be used to detect this
431 encoding, the name may include binary null characters, thus strlen
432 may return a length shorter than actually used. The real length
433 is implicitly given by the structure of the S-expression, an extra
434 null is appended for safety reasons.
436 The caller must free the returned string using `ksba_free' or
437 whatever function has been registered as a replacement.
439 -- Data type: ksba_isotime_t
440 Due to problems with the C data type `time_t', which will overflow
441 on most 32 bit machines in the year 2038, it was not advisable to
442 use this type for referencing times stored in certificates.
443 Instead, you should use the `ksba_isotime_t' type, which can
444 represent any time since the year 0.
446 It is implemented as a buffer of 16 bytes and may be handled like a
447 standard string. It should be initialized to zero (i.e. the first
448 byte needs to be 0x00) if it does not hold a valid date. Date
449 values themselves are stored in ISO format and assumed to be
450 referenced from UTC. The string with the date value is always
451 guaranteed to be of length 15 and having a format like:
452 `"19610711T172059"'. Note that the `T' is required by ISO rules.
454 A simple assignment of these data types is not a good idea. You
455 may use `strcpy' or better a specialized function like:
458 copy_time (ksba_isotime_t d, const ksba_isotime_t s)
466 For reasons of documentation a special function should also be
467 used to compare such times:
470 cmp_time (const ksba_isotime_t a, const ksba_isotime_t b)
472 return strcmp (a, b);
475 -- Function: gpg_error_t ksba_cert_get_validity
476 (ksba_cert_t CERT, int WHAT, ksba_isotime_t TIMEBUF)
477 Return the validity dates from the certificate. If no value is
478 available an empty date object (i.e. a `strlen' will be stored at
479 TIMEBUF, otherwise it will receive the date. On failure an error
482 To return the `notBefore' date, the value `0' must be supplied for
483 WHAT; `1' yields the `notAfter' value.
485 -- Function: ksba_sexp_t ksba_cert_get_public_key (ksba_cert_t CERT)
486 [This needs to get written - for now please see libksba/src/cert.c]
489 -- Function: ksba_sexp_t ksba_cert_get_sig_val (ksba_cert_t CERT)
490 [This needs to get written - for now please see libksba/src/cert.c]
492 -- Function: gpg_error_t ksba_cert_get_extension
493 (ksba_cert_t CERT, int IDX, char const **R_OID, int *R_CRIT, size_t *R_DEROFF, size_t *R_DERLEN)
494 [This needs to get written - for now please see libksba/src/cert.c]
496 -- Function: gpg_error_t ksba_cert_is_ca
497 (ksba_cert_t CERT, int *R_CA, int *R_PATHLEN)
498 Return information on the basicConstraint (2.5.19.19) of CERT.
499 R_CA receives true if this is a CA and only in that case R_PATHLEN
500 is set to the maximum certification path length or -1 if there is
504 -- Function: gpg_error_t ksba_cert_get_key_usage
505 (ksba_cert_t CERT, unsigned int *R_FLAGS)
506 Get the key usage flags. The function returns `GPG_ERR_NO_DATA' if
507 no key usage is specified. The usage flags are as shown in
508 RFC3280, section 4.2.1.3. The key usage flags are represented by a
509 bitmask, and you can test each bit using symbolic constants, which
510 tells you if that usage is set on the certificate. The constants
513 `KSBA_KEYUSAGE_DIGITAL_SIGNATURE'
514 Usable for digitalSignature.
516 `KSBA_KEYUSAGE_NON_REPUDIATION'
517 Usable for nonRepudiation.
519 `KSBA_KEYUSAGE_KEY_ENCIPHERMENT'
520 Usable for keyEncipherment.
522 `KSBA_KEYUSAGE_DATA_ENCIPHERMENT'
523 Usable for dataEncipherment.
525 `KSBA_KEYUSAGE_KEY_AGREEMENT'
526 Usable for for keyAgreement.
528 `KSBA_KEYUSAGE_KEY_CERT_SIGN'
529 Usable for keyCertSign.
531 `KSBA_KEYUSAGE_CRL_SIGN'
534 `KSBA_KEYUSAGE_ENCIPHER_ONLY'
535 Usable for encipherOnly.
537 `KSBA_KEYUSAGE_DECIPHER_ONLY'
538 Usable for decipherOnly.
540 These are the basic constraints on usage of a certificate. If you
541 need to get additional constraints, see
542 `ksba_cert_get_ext_key_usages'.
544 -- Function: gpg_error_t ksba_cert_get_ext_key_usages
545 (ksba_cert_t CERT, char **RESULT)
546 Return a string containing the extended usages for the certificate,
547 delimited by linefeeds.
549 -- Function: gpg_error_t ksba_cert_get_cert_policies
550 (ksba_cert_t CERT, char **R_POLICIES)
551 Return a string with the certificatePolicies delimited by
552 linefeeds. The return values may be extended to carry more
553 information per line, so the caller should only use the first
554 white-space delimited token per line. The function returns
555 `GPG_ERR_NO_DATA' when this extension is not used. Caller must
556 free the returned value.
559 -- Function: gpg_error_t ksba_cert_get_crl_dist_point
560 (ksba_cert_t CERT, int IDX, ksba_name_t *R_DISTPOINT, ksba_name_t *R_ISSUER, unsigned int *R_REASON)
561 Return the CRLDistPoints given in the certificate extension of
562 certificate CERT. IDX should be iterated starting from 0 until
563 the function returns `GPG_ERR_EOF'. R_DISTPOINT returns a
564 ksba_name_t object with the distribution point name(s); the return
565 value may be `NULL' to indicate that this name is not available.
566 R_ISSUER returns the CRL issuer; if the returned value is `NULL'
567 the caller should assume that the CRL issuer is the same as the
568 certificate issuer. R_REASON returns the reason for the CRL.
569 This is a bit encoded value with no bit set if no reason has been
570 specified in the certificate.
572 The caller may pass `NULL' to any of the pointer arguments if he is
573 not interested in this value. The return values for R_DISTPOINT
574 and R_ISSUER must be released by the caller using
577 -- Function: gpg_error_t ksba_cert_get_subj_key_id
578 (ksba_cert_t CERT, int *R_CRIT, ksba_sexp_t *R_KEYID)
579 Return the subjectKeyIdentifier extension as a simple allocated
580 S-expression at the address of R_KEYID. 0 is returned on success,
581 `GPG_ERR_NO_DATA' if no such extension is available or any other
582 error code. If R_CRIT is not passed as `NULL', the critical flag
583 of this is extension is stored at this address.
585 -- Function: gpg_error_t ksba_cert_get_auth_key_id
586 (ksba_cert_t CERT, ksba_sexp_t *R_KEYID, ksba_name_t *R_NAME, ksba_sexp_t *R_SERIAL)
587 Return the authorityKeyIdentifier in R_NAME and R_SERIAL or in
588 R_KEYID. `GPG_ERR_NO_DATA' is returned if no
589 authorityKeyIdentifier has been found. This error code is also
590 returned if R_KEYID has been given as NULL and only an
591 authorityKeyIdentifier with the keyIdentifier method is available.
593 -- Function: gpg_error_t ksba_cert_get_authority_info_access
594 (ksba_cert_t CERT, int IDX, char **R_METHOD, ksba_name_t *R_LOCATION)
595 Return the authorityInfoAccess attributes. IDX should be iterated
596 starting from 0 until this function returns `GPG_ERR_EOF'.
597 R_METHOD returns an allocated string with the OID of one item and
598 R_LOCATION returns the GeneralName for that OID. The returned
599 values for R_METHOD and R_LOCATION must be released by the caller
600 unless the function returned an error; the function will however
601 make sure that R_METHOD and R_LOCATION will point to `NULL' if the
602 function returns an error.
604 See RFC-2459, section 4.2.2.1 for the definition of this attribute.
606 -- Function: gpg_error_t ksba_cert_get_subject_info_access
607 (ksba_cert_t CERT, int IDX, char **R_METHOD, ksba_name_t *R_LOCATION)
608 Return the subjectInfoAccess attributes. IDX should be iterated
609 starting from 0 until this function returns `GPG_ERR_EOF'.
610 R_METHOD returns an allocated string with the OID of one item and
611 R_LOCATION returns the GeneralName for that OID. The returned
612 values for R_METHOD and R_LOCATION must be released by the caller
613 unless the function returned an error; the function will however
614 make sure that R_METHOD and R_LOCATION will point to `NULL' if the
615 function returns an error.
617 See RFC-2459, section 4.2.2.2 for the definition of this attribute.
620 File: ksba.info, Node: Setting attributes, Next: User data, Prev: Retrieving attributes, Up: Certificate Handling
622 3.3 How to set certificate attributes
623 =====================================
625 [This needs to be written. For example code see newpg/sm/sign.c]
628 File: ksba.info, Node: User data, Prev: Setting attributes, Up: Certificate Handling
630 3.4 How to associate other data with a certificate.
631 ===================================================
633 Certificate objects play a central role in many applications and often
634 it is desirable to associate other data with the certificate to avoid
635 wrapping the certificate object into an own object. `KSBA' provides a
636 mechanism for this by means of two functions:
638 -- Function: gpg_error_t ksba_cert_set_user_data
639 (ksba_cert_t CERT, const char *KEY, const void *DATA, size_t DATALEN)
640 Stores arbitrary data along with a certificate. The data is
641 expected in the buffer DATA of length DATALEN. It will be stored
642 under the string KEY. If data is already stored under this key it
643 will be replaced by the new data. Using `NULL' for DATA will
644 effectively delete the data.
646 On error (i.e. out of memory) an already existing data object
647 stored under KEY may get deleted.
649 *Caution:* This function is definitely not thread safe because we
650 don't employ any locking mechanisms.
652 -- Function: gpg_error_t ksba_cert_get_user_data (ksba_cert_t CERT,
653 const char *KEY, void *BUFFER, size_t BUFFERLEN,
655 Return user data for certificate CERT stored under the string KEY.
656 The caller needs to provide a suitable large BUFFER and the usable
657 length of this buffer in BUFFERLEN. If DATALEN is not `NULL', the
658 length of the data stored in BUFFER will be stored there.
660 If BUFFER is given as `NULL', BUFFERLEN will be ignored and the
661 required length of the buffer will be returned at DATALEN.
663 On success 0 is returned. If no data is stored under the given
664 key, `GPG_ERR_NOT_FOUND' is returned. If the provided buffer is
665 too short and BUFFER is not `NULL', `GPG_ERR_BUFFER_TOO_SHORT'
671 File: ksba.info, Node: CMS, Next: CRLs, Prev: Certificate Handling, Up: Top
673 4 Mastering the Cryptographic Message Syntax
674 ********************************************
676 The CMS is also known under the name PKCS#7. Is is a cryptographic
677 framework for securing data transactions and storage, much like
678 OpenPGP. It is heavily based on X.509 semantics and for example used
679 with the email encryption protocol S/MIME.
687 File: ksba.info, Node: CMS Basics, Next: CMS Parser, Up: CMS
692 All operations with the CMS framework require the use of a so called CMS
693 object which is internally used to keep track of the current state and
694 to store some meta information.
696 -- Data type: ksba_cms_t
697 The `ksba_cms_t' type is used for this CMS object.
699 -- Data type: ksba_stop_reason_t
700 The `ksba_stop_reason_t' type is an enumeration used for
701 communication between the phases of a parsing or building process.
703 -- Function: ksba_cms_t ksba_cms_new (void)
704 This function creates a new CMS object. The only reason the
705 function may fail is an out-of-memory condition in which case
706 `NULL' is returned. It is safe for the caller to translate this
707 to the standard error code `GPG_ERR_ENOMEM'. Any object created
708 with this function should be released after use by using
711 -- Function: void ksba_cms_release (ksba_cms_t CMS)
712 Release all resources associated with the CMS object. It is
713 perfectly okay to pass `NULL' to this function in which case
716 -- Function: gpg_error_t ksba_cms_set_reader_writer
717 (ksba_cms_t CMS, ksba_reader_t R, ksba_writer_t W)
718 About all usages of the CMS framework require some input and
719 output data (great surprise!). To accomplish this in the most
720 abstract way, no direct output functions are used - instead
721 special reader and writer objects are used instead. Depending on
722 the desired operations either a reader, a writer or both must be
723 given. Associate a reader object with CMS by passing it as R and
724 a writer object by passing it as W. Note that no reference
725 counting is done,so make sure that those objects have a lifetime
726 at least as long as CMS.
728 If you forget to set these objects, you will get an appropriate
729 error later when data is actually to be read or written. The
730 function returns zero on success or an error code when invalid
734 File: ksba.info, Node: CMS Parser, Prev: CMS Basics, Up: CMS
739 KSBA includes a versatile CMS parser for encryption (enveloped data)
740 and digital signing. The parser is capable of handling arbitrary
741 amounts of data without requiring much memory. Well, certain objects
742 are build in memory because it can be assumed that those objects are
743 limited in size; e.g. it does not make sense to use a video clip as the
744 DN despite the fact that the standard does not forbid it.
746 -- Function: gpg_error_t ksba_cms_parse
747 (ksba_cms_t CMS, ksba_stop_reason_t *R_STOPREASON)
748 This is the core function of the parser and commonly used in a
749 loop. The parsing process is divided into several phases to allow
750 the user to get information at the right time and prepare for
751 further processing. The caller has to act on certain stop reasons
752 which are returned by R_STOPREASON and set up things accordingly;
753 KSBA may introduce new stop reasons to let the caller know other
754 details; there is no need for the caller to act on every stop
755 reason; it should only do so for reasons that the caller
756 understands and which are mandatory. The function will return
757 with an error if the caller did not setup things correctly for
758 certain stop reasons.
760 The use of this function is best explained by an example, leaving
761 out all error checking.
764 ksba_cms_parse (cms, &stopreason);
765 if (stopreason == KSBA_SR_BEGIN_DATA)
768 decrypt_session_key ();
769 setup_bulk_decryption ();
771 else if (stopreason == KSBA_SR_END_DATA)
776 while (stopreason != KSBA_SR_READY);
777 This function assumes that the parsed data is so called `enveloped
780 As CMS provides a common framework for a variety of data formats, it
781 is probably very useful to check the type of that data very early.
782 This can be accomplished by hooking into the stop reason
783 `KSBA_SR_GOT_CONTENT' and retrieving the content using the following
786 -- Function: ksba_content_t ksba_cms_get_content_type
787 (ksba_cms_t CMS, int WHAT)
788 By using a value of `0' for WHAT this function returns the content
789 type of the outer container; using `1' does return the content
790 type of the enclosed object.
792 -- Data type: ksba_content_t
793 The `ksba_content_t' type is an enumeration used to describe
794 the content of a CMS message. Here is a list of possible
798 No content type known (value `0')
801 The content is plain data, not further interpreted.
803 `KSBA_CT_SIGNED_DATA'
804 The content is an signed CMS object. This also includes
805 the case of a detached signature where no actual data is
806 included in the message.
808 `KSBA_CT_ENVELOPED_DATA'
809 The content is encrypted using a session key.
811 `KSBA_CT_DIGESTED_DATA'
814 `KSBA_CT_ENCRYPTED_DATA'
820 -- Function: const char * ksba_cms_get_content_oid
821 (ksba_cms_t CMS, int WHAT)
822 Return the object ID of CMS. This is a constant string valid as
823 long as the context is valid and no new parse is started. This
824 function is similar to `ksba_cms_get_content_type' but returns the
825 OID actually used in the data. Depending on the value of WHAT
826 different values are returned: Using a value of `0' yields the OID
827 of the outer container, a value of `1' yields the OID of the inner
828 container if available and the value `2' returns the OID of the
829 algorithm used to encrypt the inner container.
832 File: ksba.info, Node: CRLs, Next: PKCS10, Prev: CMS, Up: Top
834 5 Certification Revocation Lists
835 ********************************
837 KSBA also comes with an API to process certification revocation lists.
838 The API is similar to the CMS one but returns the contents entry by
842 File: ksba.info, Node: PKCS10, Next: Utilities, Prev: CRLs, Up: Top
844 6 Certification Requests
845 ************************
847 When using decentral generated keys, it is necessary to send out special
848 formated messages so that a CA can generate the certificate.
853 File: ksba.info, Node: Utilities, Next: Error Handling, Prev: PKCS10, Up: Top
858 A few utility function and objects are available. Some of them must be
859 used to support some of the main functions.
863 * Names:: General Names object
864 * OIDs:: Object Identifier helpers
865 * DNs:: Distinguished Name helpers
868 File: ksba.info, Node: Names, Next: OIDs, Up: Utilities
870 7.1 General Names object
871 ========================
873 This is an object to handle some of the names used in X.509. We need
874 this object approach because those names may come as a set and there is
875 no other clean way to access them.
877 -- Data type: ksba_name_t
878 The `ksba_name_t' type is an object to represent names sets.
880 -- Function: void ksba_name_release (ksba_name_t NAME)
881 This function releases the object NAME. Passing `NULL' is allowed.
883 -- Function: const char * ksba_name_enum (ksba_name_t NAME, int IDX)
884 By iterating IDX up starting with 0, this function returns all
885 General Names stored in NAME. The format of the returned name is
886 either a RFC-2253 formated one which can be detected by checking
887 whether the first character is letter or a digit. RFC 2822
888 conformant email addresses are returned enclosed in angle
889 brackets, the opening angle bracket should be used to detect this.
890 Other formats are returned as an S-Expression in canonical format,
891 so an opening parenthesis may be used to detect this encoding, in
892 this case the name may include binary null characters, so strlen
893 might return a length shorter than actually used, the real length
894 is implicitly given by the structure of the S-Exp, an extra null
895 is appended for safety reasons. One common format return is a
896 Universal Resource Identifier which has the S-expression: `(uri
899 The returned string has the same lifetime as NAME.
901 -- Function: char * ksba_name_get_uri (ksba_name_t NAME, int IDX)
902 Convenience function to return names representing an URI. Caller
903 must free the returned value. Note that this function should not
904 be used to enumerate the names.
906 Here is an example on how you can use this function to enumerate
910 print_names (ksba_name_t name)
915 for (idx=0; (s = ksba_name_enum (name, idx)); idx++)
917 char *p = ksba_name_get_uri (name, idx);
927 File: ksba.info, Node: OIDs, Next: DNs, Prev: Names, Up: Utilities
929 7.2 Object Identifier helpers
930 =============================
932 [This needs to get written - for now please see libksba/src/oids.c]
935 File: ksba.info, Node: DNs, Prev: OIDs, Up: Utilities
937 7.3 Distinguished Name helpers
938 ==============================
940 These are helper functions for the so called distinguished names. They
941 are used for example as the issuer and subject name.
943 -- Function: gpg_error_t ksba_dn_teststr (const char *STRING, int SEQ,
944 size_t *RERROFF, size_t *RERRLEN)
945 Assuming that STRING contains an RFC-2253 encoded string, test
946 whether this string may be passed as a valid DN to libksba. On
947 success the functions returns `0'. On error the function returns
948 an error code and stores the offset of the erroneous part at
949 RERROFF. RERRLEN will then receive the length of the erroneous
952 This function is mostly useful to test whether a certain component
953 label is supported. SEQ should be passed as `0' for now. Any of
954 RERROFF and RERRLEN may be passed as NULL if the caller is not
955 interested at this value.
958 gpg_error_t ksba_dn_str2der (const char *string, void **rder, size_t
961 gpg_error_t ksba_dn_der2str (const void *der, size_t derlen, char
967 File: ksba.info, Node: Error Handling, Next: Component Labels, Prev: Utilities, Up: Top
972 Most functions in `KSBA' will return an error if they fail. For this
973 reason, the application should always catch the error condition and
974 take appropriate measures, for example by releasing the resources and
975 passing the error up to the caller, or by displaying a descriptive
976 message to the user and canceling the operation.
978 Some error values do not indicate a system error or an error in the
979 operation, but the reasonable result of an operation. For example, if
980 you try to access optional attributes of a certificate that are not
981 present, you get an appropriate error message. Some error values have
982 specific meanings if returned by a specific function. Such cases are
983 described in the documentation of those functions.
985 All error codes are defined by the library `libgpg-error'. See
986 there for ways to check the error values and print descriptive strings.
987 Please be aware that you can't check directly against an error code but
988 have to do it like this:
991 if (gpg_err_code (err) == GPG_ERR_EOF)
994 The only exception is that success (i.e. no error) is defined to be
995 `0'; thus you may directly test for success like:
1001 File: ksba.info, Node: Component Labels, Next: Copying, Prev: Error Handling, Up: Top
1003 Appendix A Component Labels
1004 ***************************
1006 RFC-2253 defines the following table with string representations of name
1011 C countryName 2.5.4.6
1012 CN commonName 2.5.4.3
1013 DC domainComponent 0.9.2342.19200300.100.1.25
1014 L localityName 2.5.4.7
1015 O organizationName 2.5.4.10
1016 OU organizationalUnit 2.5.4.11
1017 ST stateOrProvince 2.5.4.8
1018 STREET streetAddress 2.5.4.9
1019 UID userid 0.9.2342.19200300.100.1.1
1021 They are used internally for converting a DN into its string
1022 representation; components not listed in this table will be represented
1025 For the other direction, i.e. creating a DN from the string
1026 representation, KSBA recognizes the following extra labels:
1030 ADDR postalAddress 2.5.4.16
1031 BC businessCategory 2.5.4.15
1032 D description 2.5.4.13
1033 EMAIL emailAddress 1.2.840.113549.1.9.1
1034 GN givenName 2.5.4.42
1035 POSTALCODE postalCode 2.5.4.17
1036 PSEUDO pseudonym 2.5.4.65
1037 SERIALNUMBER serialNumber 2.5.4.5
1042 File: ksba.info, Node: Copying, Next: Concept Index, Prev: Component Labels, Up: Top
1044 GNU General Public License
1045 **************************
1047 Version 3, 29 June 2007
1049 Copyright (C) 2007 Free Software Foundation, Inc. `http://fsf.org/'
1051 Everyone is permitted to copy and distribute verbatim copies of this
1052 license document, but changing it is not allowed.
1057 The GNU General Public License is a free, copyleft license for software
1058 and other kinds of works.
1060 The licenses for most software and other practical works are designed
1061 to take away your freedom to share and change the works. By contrast,
1062 the GNU General Public License is intended to guarantee your freedom to
1063 share and change all versions of a program-to make sure it remains free
1064 software for all its users. We, the Free Software Foundation, use the
1065 GNU General Public License for most of our software; it applies also to
1066 any other work released this way by its authors. You can apply it to
1069 When we speak of free software, we are referring to freedom, not
1070 price. Our General Public Licenses are designed to make sure that you
1071 have the freedom to distribute copies of free software (and charge for
1072 them if you wish), that you receive source code or can get it if you
1073 want it, that you can change the software or use pieces of it in new
1074 free programs, and that you know you can do these things.
1076 To protect your rights, we need to prevent others from denying you
1077 these rights or asking you to surrender the rights. Therefore, you
1078 have certain responsibilities if you distribute copies of the software,
1079 or if you modify it: responsibilities to respect the freedom of others.
1081 For example, if you distribute copies of such a program, whether
1082 gratis or for a fee, you must pass on to the recipients the same
1083 freedoms that you received. You must make sure that they, too, receive
1084 or can get the source code. And you must show them these terms so they
1087 Developers that use the GNU GPL protect your rights with two steps:
1088 (1) assert copyright on the software, and (2) offer you this License
1089 giving you legal permission to copy, distribute and/or modify it.
1091 For the developers' and authors' protection, the GPL clearly explains
1092 that there is no warranty for this free software. For both users' and
1093 authors' sake, the GPL requires that modified versions be marked as
1094 changed, so that their problems will not be attributed erroneously to
1095 authors of previous versions.
1097 Some devices are designed to deny users access to install or run
1098 modified versions of the software inside them, although the
1099 manufacturer can do so. This is fundamentally incompatible with the
1100 aim of protecting users' freedom to change the software. The
1101 systematic pattern of such abuse occurs in the area of products for
1102 individuals to use, which is precisely where it is most unacceptable.
1103 Therefore, we have designed this version of the GPL to prohibit the
1104 practice for those products. If such problems arise substantially in
1105 other domains, we stand ready to extend this provision to those domains
1106 in future versions of the GPL, as needed to protect the freedom of
1109 Finally, every program is threatened constantly by software patents.
1110 States should not allow patents to restrict development and use of
1111 software on general-purpose computers, but in those that do, we wish to
1112 avoid the special danger that patents applied to a free program could
1113 make it effectively proprietary. To prevent this, the GPL assures that
1114 patents cannot be used to render the program non-free.
1116 The precise terms and conditions for copying, distribution and
1117 modification follow.
1119 TERMS AND CONDITIONS
1122 "This License" refers to version 3 of the GNU General Public
1125 "Copyright" also means copyright-like laws that apply to other
1126 kinds of works, such as semiconductor masks.
1128 "The Program" refers to any copyrightable work licensed under this
1129 License. Each licensee is addressed as "you". "Licensees" and
1130 "recipients" may be individuals or organizations.
1132 To "modify" a work means to copy from or adapt all or part of the
1133 work in a fashion requiring copyright permission, other than the
1134 making of an exact copy. The resulting work is called a "modified
1135 version" of the earlier work or a work "based on" the earlier work.
1137 A "covered work" means either the unmodified Program or a work
1138 based on the Program.
1140 To "propagate" a work means to do anything with it that, without
1141 permission, would make you directly or secondarily liable for
1142 infringement under applicable copyright law, except executing it
1143 on a computer or modifying a private copy. Propagation includes
1144 copying, distribution (with or without modification), making
1145 available to the public, and in some countries other activities as
1148 To "convey" a work means any kind of propagation that enables other
1149 parties to make or receive copies. Mere interaction with a user
1150 through a computer network, with no transfer of a copy, is not
1153 An interactive user interface displays "Appropriate Legal Notices"
1154 to the extent that it includes a convenient and prominently visible
1155 feature that (1) displays an appropriate copyright notice, and (2)
1156 tells the user that there is no warranty for the work (except to
1157 the extent that warranties are provided), that licensees may
1158 convey the work under this License, and how to view a copy of this
1159 License. If the interface presents a list of user commands or
1160 options, such as a menu, a prominent item in the list meets this
1165 The "source code" for a work means the preferred form of the work
1166 for making modifications to it. "Object code" means any
1167 non-source form of a work.
1169 A "Standard Interface" means an interface that either is an
1170 official standard defined by a recognized standards body, or, in
1171 the case of interfaces specified for a particular programming
1172 language, one that is widely used among developers working in that
1175 The "System Libraries" of an executable work include anything,
1176 other than the work as a whole, that (a) is included in the normal
1177 form of packaging a Major Component, but which is not part of that
1178 Major Component, and (b) serves only to enable use of the work
1179 with that Major Component, or to implement a Standard Interface
1180 for which an implementation is available to the public in source
1181 code form. A "Major Component", in this context, means a major
1182 essential component (kernel, window system, and so on) of the
1183 specific operating system (if any) on which the executable work
1184 runs, or a compiler used to produce the work, or an object code
1185 interpreter used to run it.
1187 The "Corresponding Source" for a work in object code form means all
1188 the source code needed to generate, install, and (for an executable
1189 work) run the object code and to modify the work, including
1190 scripts to control those activities. However, it does not include
1191 the work's System Libraries, or general-purpose tools or generally
1192 available free programs which are used unmodified in performing
1193 those activities but which are not part of the work. For example,
1194 Corresponding Source includes interface definition files
1195 associated with source files for the work, and the source code for
1196 shared libraries and dynamically linked subprograms that the work
1197 is specifically designed to require, such as by intimate data
1198 communication or control flow between those subprograms and other
1201 The Corresponding Source need not include anything that users can
1202 regenerate automatically from other parts of the Corresponding
1205 The Corresponding Source for a work in source code form is that
1208 2. Basic Permissions.
1210 All rights granted under this License are granted for the term of
1211 copyright on the Program, and are irrevocable provided the stated
1212 conditions are met. This License explicitly affirms your unlimited
1213 permission to run the unmodified Program. The output from running
1214 a covered work is covered by this License only if the output,
1215 given its content, constitutes a covered work. This License
1216 acknowledges your rights of fair use or other equivalent, as
1217 provided by copyright law.
1219 You may make, run and propagate covered works that you do not
1220 convey, without conditions so long as your license otherwise
1221 remains in force. You may convey covered works to others for the
1222 sole purpose of having them make modifications exclusively for
1223 you, or provide you with facilities for running those works,
1224 provided that you comply with the terms of this License in
1225 conveying all material for which you do not control copyright.
1226 Those thus making or running the covered works for you must do so
1227 exclusively on your behalf, under your direction and control, on
1228 terms that prohibit them from making any copies of your
1229 copyrighted material outside their relationship with you.
1231 Conveying under any other circumstances is permitted solely under
1232 the conditions stated below. Sublicensing is not allowed; section
1233 10 makes it unnecessary.
1235 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
1237 No covered work shall be deemed part of an effective technological
1238 measure under any applicable law fulfilling obligations under
1239 article 11 of the WIPO copyright treaty adopted on 20 December
1240 1996, or similar laws prohibiting or restricting circumvention of
1243 When you convey a covered work, you waive any legal power to forbid
1244 circumvention of technological measures to the extent such
1245 circumvention is effected by exercising rights under this License
1246 with respect to the covered work, and you disclaim any intention
1247 to limit operation or modification of the work as a means of
1248 enforcing, against the work's users, your or third parties' legal
1249 rights to forbid circumvention of technological measures.
1251 4. Conveying Verbatim Copies.
1253 You may convey verbatim copies of the Program's source code as you
1254 receive it, in any medium, provided that you conspicuously and
1255 appropriately publish on each copy an appropriate copyright notice;
1256 keep intact all notices stating that this License and any
1257 non-permissive terms added in accord with section 7 apply to the
1258 code; keep intact all notices of the absence of any warranty; and
1259 give all recipients a copy of this License along with the Program.
1261 You may charge any price or no price for each copy that you convey,
1262 and you may offer support or warranty protection for a fee.
1264 5. Conveying Modified Source Versions.
1266 You may convey a work based on the Program, or the modifications to
1267 produce it from the Program, in the form of source code under the
1268 terms of section 4, provided that you also meet all of these
1271 a. The work must carry prominent notices stating that you
1272 modified it, and giving a relevant date.
1274 b. The work must carry prominent notices stating that it is
1275 released under this License and any conditions added under
1276 section 7. This requirement modifies the requirement in
1277 section 4 to "keep intact all notices".
1279 c. You must license the entire work, as a whole, under this
1280 License to anyone who comes into possession of a copy. This
1281 License will therefore apply, along with any applicable
1282 section 7 additional terms, to the whole of the work, and all
1283 its parts, regardless of how they are packaged. This License
1284 gives no permission to license the work in any other way, but
1285 it does not invalidate such permission if you have separately
1288 d. If the work has interactive user interfaces, each must display
1289 Appropriate Legal Notices; however, if the Program has
1290 interactive interfaces that do not display Appropriate Legal
1291 Notices, your work need not make them do so.
1293 A compilation of a covered work with other separate and independent
1294 works, which are not by their nature extensions of the covered
1295 work, and which are not combined with it such as to form a larger
1296 program, in or on a volume of a storage or distribution medium, is
1297 called an "aggregate" if the compilation and its resulting
1298 copyright are not used to limit the access or legal rights of the
1299 compilation's users beyond what the individual works permit.
1300 Inclusion of a covered work in an aggregate does not cause this
1301 License to apply to the other parts of the aggregate.
1303 6. Conveying Non-Source Forms.
1305 You may convey a covered work in object code form under the terms
1306 of sections 4 and 5, provided that you also convey the
1307 machine-readable Corresponding Source under the terms of this
1308 License, in one of these ways:
1310 a. Convey the object code in, or embodied in, a physical product
1311 (including a physical distribution medium), accompanied by the
1312 Corresponding Source fixed on a durable physical medium
1313 customarily used for software interchange.
1315 b. Convey the object code in, or embodied in, a physical product
1316 (including a physical distribution medium), accompanied by a
1317 written offer, valid for at least three years and valid for
1318 as long as you offer spare parts or customer support for that
1319 product model, to give anyone who possesses the object code
1320 either (1) a copy of the Corresponding Source for all the
1321 software in the product that is covered by this License, on a
1322 durable physical medium customarily used for software
1323 interchange, for a price no more than your reasonable cost of
1324 physically performing this conveying of source, or (2) access
1325 to copy the Corresponding Source from a network server at no
1328 c. Convey individual copies of the object code with a copy of
1329 the written offer to provide the Corresponding Source. This
1330 alternative is allowed only occasionally and noncommercially,
1331 and only if you received the object code with such an offer,
1332 in accord with subsection 6b.
1334 d. Convey the object code by offering access from a designated
1335 place (gratis or for a charge), and offer equivalent access
1336 to the Corresponding Source in the same way through the same
1337 place at no further charge. You need not require recipients
1338 to copy the Corresponding Source along with the object code.
1339 If the place to copy the object code is a network server, the
1340 Corresponding Source may be on a different server (operated
1341 by you or a third party) that supports equivalent copying
1342 facilities, provided you maintain clear directions next to
1343 the object code saying where to find the Corresponding Source.
1344 Regardless of what server hosts the Corresponding Source, you
1345 remain obligated to ensure that it is available for as long
1346 as needed to satisfy these requirements.
1348 e. Convey the object code using peer-to-peer transmission,
1349 provided you inform other peers where the object code and
1350 Corresponding Source of the work are being offered to the
1351 general public at no charge under subsection 6d.
1354 A separable portion of the object code, whose source code is
1355 excluded from the Corresponding Source as a System Library, need
1356 not be included in conveying the object code work.
1358 A "User Product" is either (1) a "consumer product", which means
1359 any tangible personal property which is normally used for personal,
1360 family, or household purposes, or (2) anything designed or sold for
1361 incorporation into a dwelling. In determining whether a product
1362 is a consumer product, doubtful cases shall be resolved in favor of
1363 coverage. For a particular product received by a particular user,
1364 "normally used" refers to a typical or common use of that class of
1365 product, regardless of the status of the particular user or of the
1366 way in which the particular user actually uses, or expects or is
1367 expected to use, the product. A product is a consumer product
1368 regardless of whether the product has substantial commercial,
1369 industrial or non-consumer uses, unless such uses represent the
1370 only significant mode of use of the product.
1372 "Installation Information" for a User Product means any methods,
1373 procedures, authorization keys, or other information required to
1374 install and execute modified versions of a covered work in that
1375 User Product from a modified version of its Corresponding Source.
1376 The information must suffice to ensure that the continued
1377 functioning of the modified object code is in no case prevented or
1378 interfered with solely because modification has been made.
1380 If you convey an object code work under this section in, or with,
1381 or specifically for use in, a User Product, and the conveying
1382 occurs as part of a transaction in which the right of possession
1383 and use of the User Product is transferred to the recipient in
1384 perpetuity or for a fixed term (regardless of how the transaction
1385 is characterized), the Corresponding Source conveyed under this
1386 section must be accompanied by the Installation Information. But
1387 this requirement does not apply if neither you nor any third party
1388 retains the ability to install modified object code on the User
1389 Product (for example, the work has been installed in ROM).
1391 The requirement to provide Installation Information does not
1392 include a requirement to continue to provide support service,
1393 warranty, or updates for a work that has been modified or
1394 installed by the recipient, or for the User Product in which it
1395 has been modified or installed. Access to a network may be denied
1396 when the modification itself materially and adversely affects the
1397 operation of the network or violates the rules and protocols for
1398 communication across the network.
1400 Corresponding Source conveyed, and Installation Information
1401 provided, in accord with this section must be in a format that is
1402 publicly documented (and with an implementation available to the
1403 public in source code form), and must require no special password
1404 or key for unpacking, reading or copying.
1406 7. Additional Terms.
1408 "Additional permissions" are terms that supplement the terms of
1409 this License by making exceptions from one or more of its
1410 conditions. Additional permissions that are applicable to the
1411 entire Program shall be treated as though they were included in
1412 this License, to the extent that they are valid under applicable
1413 law. If additional permissions apply only to part of the Program,
1414 that part may be used separately under those permissions, but the
1415 entire Program remains governed by this License without regard to
1416 the additional permissions.
1418 When you convey a copy of a covered work, you may at your option
1419 remove any additional permissions from that copy, or from any part
1420 of it. (Additional permissions may be written to require their own
1421 removal in certain cases when you modify the work.) You may place
1422 additional permissions on material, added by you to a covered work,
1423 for which you have or can give appropriate copyright permission.
1425 Notwithstanding any other provision of this License, for material
1426 you add to a covered work, you may (if authorized by the copyright
1427 holders of that material) supplement the terms of this License
1430 a. Disclaiming warranty or limiting liability differently from
1431 the terms of sections 15 and 16 of this License; or
1433 b. Requiring preservation of specified reasonable legal notices
1434 or author attributions in that material or in the Appropriate
1435 Legal Notices displayed by works containing it; or
1437 c. Prohibiting misrepresentation of the origin of that material,
1438 or requiring that modified versions of such material be
1439 marked in reasonable ways as different from the original
1442 d. Limiting the use for publicity purposes of names of licensors
1443 or authors of the material; or
1445 e. Declining to grant rights under trademark law for use of some
1446 trade names, trademarks, or service marks; or
1448 f. Requiring indemnification of licensors and authors of that
1449 material by anyone who conveys the material (or modified
1450 versions of it) with contractual assumptions of liability to
1451 the recipient, for any liability that these contractual
1452 assumptions directly impose on those licensors and authors.
1454 All other non-permissive additional terms are considered "further
1455 restrictions" within the meaning of section 10. If the Program as
1456 you received it, or any part of it, contains a notice stating that
1457 it is governed by this License along with a term that is a further
1458 restriction, you may remove that term. If a license document
1459 contains a further restriction but permits relicensing or
1460 conveying under this License, you may add to a covered work
1461 material governed by the terms of that license document, provided
1462 that the further restriction does not survive such relicensing or
1465 If you add terms to a covered work in accord with this section, you
1466 must place, in the relevant source files, a statement of the
1467 additional terms that apply to those files, or a notice indicating
1468 where to find the applicable terms.
1470 Additional terms, permissive or non-permissive, may be stated in
1471 the form of a separately written license, or stated as exceptions;
1472 the above requirements apply either way.
1476 You may not propagate or modify a covered work except as expressly
1477 provided under this License. Any attempt otherwise to propagate or
1478 modify it is void, and will automatically terminate your rights
1479 under this License (including any patent licenses granted under
1480 the third paragraph of section 11).
1482 However, if you cease all violation of this License, then your
1483 license from a particular copyright holder is reinstated (a)
1484 provisionally, unless and until the copyright holder explicitly
1485 and finally terminates your license, and (b) permanently, if the
1486 copyright holder fails to notify you of the violation by some
1487 reasonable means prior to 60 days after the cessation.
1489 Moreover, your license from a particular copyright holder is
1490 reinstated permanently if the copyright holder notifies you of the
1491 violation by some reasonable means, this is the first time you have
1492 received notice of violation of this License (for any work) from
1493 that copyright holder, and you cure the violation prior to 30 days
1494 after your receipt of the notice.
1496 Termination of your rights under this section does not terminate
1497 the licenses of parties who have received copies or rights from
1498 you under this License. If your rights have been terminated and
1499 not permanently reinstated, you do not qualify to receive new
1500 licenses for the same material under section 10.
1502 9. Acceptance Not Required for Having Copies.
1504 You are not required to accept this License in order to receive or
1505 run a copy of the Program. Ancillary propagation of a covered work
1506 occurring solely as a consequence of using peer-to-peer
1507 transmission to receive a copy likewise does not require
1508 acceptance. However, nothing other than this License grants you
1509 permission to propagate or modify any covered work. These actions
1510 infringe copyright if you do not accept this License. Therefore,
1511 by modifying or propagating a covered work, you indicate your
1512 acceptance of this License to do so.
1514 10. Automatic Licensing of Downstream Recipients.
1516 Each time you convey a covered work, the recipient automatically
1517 receives a license from the original licensors, to run, modify and
1518 propagate that work, subject to this License. You are not
1519 responsible for enforcing compliance by third parties with this
1522 An "entity transaction" is a transaction transferring control of an
1523 organization, or substantially all assets of one, or subdividing an
1524 organization, or merging organizations. If propagation of a
1525 covered work results from an entity transaction, each party to that
1526 transaction who receives a copy of the work also receives whatever
1527 licenses to the work the party's predecessor in interest had or
1528 could give under the previous paragraph, plus a right to
1529 possession of the Corresponding Source of the work from the
1530 predecessor in interest, if the predecessor has it or can get it
1531 with reasonable efforts.
1533 You may not impose any further restrictions on the exercise of the
1534 rights granted or affirmed under this License. For example, you
1535 may not impose a license fee, royalty, or other charge for
1536 exercise of rights granted under this License, and you may not
1537 initiate litigation (including a cross-claim or counterclaim in a
1538 lawsuit) alleging that any patent claim is infringed by making,
1539 using, selling, offering for sale, or importing the Program or any
1544 A "contributor" is a copyright holder who authorizes use under this
1545 License of the Program or a work on which the Program is based.
1546 The work thus licensed is called the contributor's "contributor
1549 A contributor's "essential patent claims" are all patent claims
1550 owned or controlled by the contributor, whether already acquired or
1551 hereafter acquired, that would be infringed by some manner,
1552 permitted by this License, of making, using, or selling its
1553 contributor version, but do not include claims that would be
1554 infringed only as a consequence of further modification of the
1555 contributor version. For purposes of this definition, "control"
1556 includes the right to grant patent sublicenses in a manner
1557 consistent with the requirements of this License.
1559 Each contributor grants you a non-exclusive, worldwide,
1560 royalty-free patent license under the contributor's essential
1561 patent claims, to make, use, sell, offer for sale, import and
1562 otherwise run, modify and propagate the contents of its
1563 contributor version.
1565 In the following three paragraphs, a "patent license" is any
1566 express agreement or commitment, however denominated, not to
1567 enforce a patent (such as an express permission to practice a
1568 patent or covenant not to sue for patent infringement). To
1569 "grant" such a patent license to a party means to make such an
1570 agreement or commitment not to enforce a patent against the party.
1572 If you convey a covered work, knowingly relying on a patent
1573 license, and the Corresponding Source of the work is not available
1574 for anyone to copy, free of charge and under the terms of this
1575 License, through a publicly available network server or other
1576 readily accessible means, then you must either (1) cause the
1577 Corresponding Source to be so available, or (2) arrange to deprive
1578 yourself of the benefit of the patent license for this particular
1579 work, or (3) arrange, in a manner consistent with the requirements
1580 of this License, to extend the patent license to downstream
1581 recipients. "Knowingly relying" means you have actual knowledge
1582 that, but for the patent license, your conveying the covered work
1583 in a country, or your recipient's use of the covered work in a
1584 country, would infringe one or more identifiable patents in that
1585 country that you have reason to believe are valid.
1587 If, pursuant to or in connection with a single transaction or
1588 arrangement, you convey, or propagate by procuring conveyance of, a
1589 covered work, and grant a patent license to some of the parties
1590 receiving the covered work authorizing them to use, propagate,
1591 modify or convey a specific copy of the covered work, then the
1592 patent license you grant is automatically extended to all
1593 recipients of the covered work and works based on it.
1595 A patent license is "discriminatory" if it does not include within
1596 the scope of its coverage, prohibits the exercise of, or is
1597 conditioned on the non-exercise of one or more of the rights that
1598 are specifically granted under this License. You may not convey a
1599 covered work if you are a party to an arrangement with a third
1600 party that is in the business of distributing software, under
1601 which you make payment to the third party based on the extent of
1602 your activity of conveying the work, and under which the third
1603 party grants, to any of the parties who would receive the covered
1604 work from you, a discriminatory patent license (a) in connection
1605 with copies of the covered work conveyed by you (or copies made
1606 from those copies), or (b) primarily for and in connection with
1607 specific products or compilations that contain the covered work,
1608 unless you entered into that arrangement, or that patent license
1609 was granted, prior to 28 March 2007.
1611 Nothing in this License shall be construed as excluding or limiting
1612 any implied license or other defenses to infringement that may
1613 otherwise be available to you under applicable patent law.
1615 12. No Surrender of Others' Freedom.
1617 If conditions are imposed on you (whether by court order,
1618 agreement or otherwise) that contradict the conditions of this
1619 License, they do not excuse you from the conditions of this
1620 License. If you cannot convey a covered work so as to satisfy
1621 simultaneously your obligations under this License and any other
1622 pertinent obligations, then as a consequence you may not convey it
1623 at all. For example, if you agree to terms that obligate you to
1624 collect a royalty for further conveying from those to whom you
1625 convey the Program, the only way you could satisfy both those
1626 terms and this License would be to refrain entirely from conveying
1629 13. Use with the GNU Affero General Public License.
1631 Notwithstanding any other provision of this License, you have
1632 permission to link or combine any covered work with a work licensed
1633 under version 3 of the GNU Affero General Public License into a
1634 single combined work, and to convey the resulting work. The terms
1635 of this License will continue to apply to the part which is the
1636 covered work, but the special requirements of the GNU Affero
1637 General Public License, section 13, concerning interaction through
1638 a network will apply to the combination as such.
1640 14. Revised Versions of this License.
1642 The Free Software Foundation may publish revised and/or new
1643 versions of the GNU General Public License from time to time.
1644 Such new versions will be similar in spirit to the present
1645 version, but may differ in detail to address new problems or
1648 Each version is given a distinguishing version number. If the
1649 Program specifies that a certain numbered version of the GNU
1650 General Public License "or any later version" applies to it, you
1651 have the option of following the terms and conditions either of
1652 that numbered version or of any later version published by the
1653 Free Software Foundation. If the Program does not specify a
1654 version number of the GNU General Public License, you may choose
1655 any version ever published by the Free Software Foundation.
1657 If the Program specifies that a proxy can decide which future
1658 versions of the GNU General Public License can be used, that
1659 proxy's public statement of acceptance of a version permanently
1660 authorizes you to choose that version for the Program.
1662 Later license versions may give you additional or different
1663 permissions. However, no additional obligations are imposed on any
1664 author or copyright holder as a result of your choosing to follow a
1667 15. Disclaimer of Warranty.
1669 THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
1670 APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE
1671 COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS"
1672 WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
1673 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1674 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE
1675 RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.
1676 SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
1677 NECESSARY SERVICING, REPAIR OR CORRECTION.
1679 16. Limitation of Liability.
1681 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
1682 WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES
1683 AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU
1684 FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
1685 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
1686 THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
1687 BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
1688 PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
1689 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF
1690 THE POSSIBILITY OF SUCH DAMAGES.
1692 17. Interpretation of Sections 15 and 16.
1694 If the disclaimer of warranty and limitation of liability provided
1695 above cannot be given local legal effect according to their terms,
1696 reviewing courts shall apply local law that most closely
1697 approximates an absolute waiver of all civil liability in
1698 connection with the Program, unless a warranty or assumption of
1699 liability accompanies a copy of the Program in return for a fee.
1702 END OF TERMS AND CONDITIONS
1703 How to Apply These Terms to Your New Programs
1704 =============================================
1706 If you develop a new program, and you want it to be of the greatest
1707 possible use to the public, the best way to achieve this is to make it
1708 free software which everyone can redistribute and change under these
1711 To do so, attach the following notices to the program. It is safest
1712 to attach them to the start of each source file to most effectively
1713 state the exclusion of warranty; and each file should have at least the
1714 "copyright" line and a pointer to where the full notice is found.
1716 ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES.
1717 Copyright (C) YEAR NAME OF AUTHOR
1719 This program is free software: you can redistribute it and/or modify
1720 it under the terms of the GNU General Public License as published by
1721 the Free Software Foundation, either version 3 of the License, or (at
1722 your option) any later version.
1724 This program is distributed in the hope that it will be useful, but
1725 WITHOUT ANY WARRANTY; without even the implied warranty of
1726 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1727 General Public License for more details.
1729 You should have received a copy of the GNU General Public License
1730 along with this program. If not, see `http://www.gnu.org/licenses/'.
1732 Also add information on how to contact you by electronic and paper mail.
1734 If the program does terminal interaction, make it output a short notice
1735 like this when it starts in an interactive mode:
1737 PROGRAM Copyright (C) YEAR NAME OF AUTHOR
1738 This program comes with ABSOLUTELY NO WARRANTY; for details
1739 type `show w'. This is free software, and you are
1740 welcome to redistribute it under certain conditions;
1741 type `show c' for details.
1743 The hypothetical commands `show w' and `show c' should show the
1744 appropriate parts of the General Public License. Of course, your
1745 program's commands might be different; for a GUI interface, you would
1748 You should also get your employer (if you work as a programmer) or
1749 school, if any, to sign a "copyright disclaimer" for the program, if
1750 necessary. For more information on this, and how to apply and follow
1751 the GNU GPL, see `http://www.gnu.org/licenses/'.
1753 The GNU General Public License does not permit incorporating your
1754 program into proprietary programs. If your program is a subroutine
1755 library, you may consider it more useful to permit linking proprietary
1756 applications with the library. If this is what you want to do, use the
1757 GNU Lesser General Public License instead of this License. But first,
1758 please read `http://www.gnu.org/philosophy/why-not-lgpl.html'.
1761 File: ksba.info, Node: Concept Index, Next: Function and Data Index, Prev: Copying, Up: Top
1769 File: ksba.info, Node: Function and Data Index, Prev: Concept Index, Up: Top
1771 Function and Data Index
1772 ***********************
1777 * ksba_cert_get_auth_key_id: Retrieving attributes.
1779 * ksba_cert_get_authority_info_access: Retrieving attributes.
1781 * ksba_cert_get_cert_policies: Retrieving attributes.
1783 * ksba_cert_get_crl_dist_point: Retrieving attributes.
1785 * ksba_cert_get_digest_algo: Retrieving attributes.
1787 * ksba_cert_get_ext_key_usages: Retrieving attributes.
1789 * ksba_cert_get_extension: Retrieving attributes.
1791 * ksba_cert_get_image: Retrieving attributes.
1793 * ksba_cert_get_issuer: Retrieving attributes.
1795 * ksba_cert_get_key_usage: Retrieving attributes.
1797 * ksba_cert_get_public_key: Retrieving attributes.
1799 * ksba_cert_get_serial: Retrieving attributes.
1801 * ksba_cert_get_sig_val: Retrieving attributes.
1803 * ksba_cert_get_subj_key_id: Retrieving attributes.
1805 * ksba_cert_get_subject: Retrieving attributes.
1807 * ksba_cert_get_subject_info_access: Retrieving attributes.
1809 * ksba_cert_get_user_data: User data. (line 28)
1810 * ksba_cert_get_validity: Retrieving attributes.
1812 * ksba_cert_hash: Retrieving attributes.
1814 * ksba_cert_init_from_mem: Creating certificates.
1816 * ksba_cert_is_ca: Retrieving attributes.
1818 * ksba_cert_new: Creating certificates.
1820 * ksba_cert_read_der: Creating certificates.
1822 * ksba_cert_ref: Creating certificates.
1824 * ksba_cert_release: Creating certificates.
1826 * ksba_cert_set_user_data: User data. (line 13)
1827 * ksba_cert_t: Certificate Handling.
1829 * ksba_check_version: Version Check. (line 13)
1830 * ksba_cms_get_content_oid: CMS Parser. (line 89)
1831 * ksba_cms_get_content_type: CMS Parser. (line 55)
1832 * ksba_cms_new: CMS Basics. (line 18)
1833 * ksba_cms_parse: CMS Parser. (line 15)
1834 * ksba_cms_release: CMS Basics. (line 26)
1835 * ksba_cms_set_reader_writer: CMS Basics. (line 32)
1836 * ksba_cms_t: CMS Basics. (line 11)
1837 * ksba_content_t: CMS Parser. (line 60)
1838 * ksba_dn_teststr: DNs. (line 11)
1839 * ksba_isotime_t: Retrieving attributes.
1841 * ksba_name_enum: Names. (line 17)
1842 * ksba_name_get_uri: Names. (line 35)
1843 * ksba_name_release: Names. (line 14)
1844 * ksba_name_t: Names. (line 11)
1845 * ksba_sexp_t: Certificate Handling.
1847 * ksba_stop_reason_t: CMS Basics. (line 14)
1853 Node: Introduction
\7f2821
1854 Node: Getting Started
\7f3099
1855 Node: Features
\7f3965
1856 Node: Overview
\7f5056
1857 Node: Preparation
\7f5305
1859 Node: Version Check
\7f6384
1860 Node: Building the source
\7f7475
1861 Node: Certificate Handling
\7f9319
1862 Node: Creating certificates
\7f10300
1863 Node: Retrieving attributes
\7f12756
1864 Node: Setting attributes
\7f26404
1865 Node: User data
\7f26669
1867 Node: CMS Basics
\7f29050
1868 Node: CMS Parser
\7f31112
1870 Node: PKCS10
\7f35361
1871 Node: Utilities
\7f35628
1875 Node: Error Handling
\7f39680
1876 Node: Component Labels
\7f41034
1877 Node: Copying
\7f42524
1878 Node: Concept Index
\7f80067
1879 Node: Function and Data Index
\7f80215