1 This is ksba.info, produced by makeinfo version 6.5 from ksba.texi.
3 INFO-DIR-SECTION GNU libraries
5 * libksba: (ksba). An X.509 Library.
8 This file documents the KSBA library to access X.509 and CMS data
11 This is edition 1.4.0, last updated 12 May 2020, of 'The KSBA
12 Reference Manual', for Version 1.4.0.
14 Copyright (C) 2002, 2003, 2004 g10 Code GmbH
16 Permission is granted to copy, distribute and/or modify this document
17 under the terms of the GNU General Public License as published by the
18 Free Software Foundation; either version 3 of the License, or (at your
19 option) any later version. The text of the license can be found in the
20 section entitled "Copying".
23 File: ksba.info, Node: Top, Next: Introduction, Up: (dir)
28 This is edition 1.4.0, last updated 12 May 2020, of 'The KSBA Reference
29 Manual', for Version 1.4.0 of the KSBA library.
31 Copyright (C) 2002, 2003, 2004 g10 Code GmbH
33 Permission is granted to copy, distribute and/or modify this document
34 under the terms of the GNU General Public License as published by the
35 Free Software Foundation; either version 3 of the License, or (at your
36 option) any later version. The text of the license can be found in the
37 section entitled "Copying".
41 * Introduction:: How to use this manual.
42 * Preparation:: What you should do before using the library.
43 * Certificate Handling:: How to work with X.509 certificates.
44 * CMS:: How to work with CMS (PKCS#7) messages.
45 * CRLs:: How to work with Certificate Revocation Lists.
46 * PKCS10:: How to request certificates.
47 * Utilities:: Various utility functions.
48 * Error Handling:: Error numbers and their meanings.
52 * Component Labels:: Labels used in string representations.
53 * Copying:: The GNU General Public License says how you
54 can copy and share this manual.
58 * Concept Index:: Index of concepts and programs.
59 * Function and Data Index:: Index of functions, variables and data types.
61 -- The Detailed Node Listing --
72 * Building the source::
76 * Creating certificates:: How to create a certificate object.
77 * Retrieving attributes:: How to get the attributes of a certificate.
78 * Setting attributes:: How to set certificates attributes.
79 * User data:: How to associate other data with a certificate.
81 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 can
116 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 the
134 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 one
146 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 and
193 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)
209 Check that the the version of the library is at minimum the one
210 given as a string in REQ_VERSION and return the actual version
211 string of the library; return 'NULL' if the condition is not met.
212 If 'NULL' is passed to this function, no check is done and only the
213 version string is returned. It is a pretty good idea to run this
214 function as soon as possible, because it may also initializes some
215 subsystems. In a multi-threaded environment if should be called
216 before any more threads are created.
219 File: ksba.info, Node: Building the source, Prev: Version Check, Up: Preparation
221 2.3 Building the source
222 =======================
224 If you want to compile a source file including the 'ksba.h' header file,
225 you must make sure that the compiler can find it in the directory
226 hierarchy. This is accomplished by adding the path to the directory in
227 which the header file is located to the compiler's include file search
228 path (via the '-I' option).
230 However, the path to the include file is determined at the time the
231 source is configured. To solve this problem, 'KSBA' ships with a small
232 helper program 'ksba-config' that knows about the path to the include
233 file and other configuration options. The options that need to be added
234 to the compiler invocation at compile time are output by the '--cflags'
235 option of 'ksba-config'. The following example shows how it can be used
238 gcc -c foo.c `ksba-config --cflags`
240 Adding the output of 'ksba-config --cflags' to the compiler's command
241 line will ensure that the compiler can find the 'ksba.h' header file.
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 the
300 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 in
312 which case nothing happens.
314 -- Function: gpg_error_t ksba_cert_read_der (ksba_cert_t CERT,
315 ksba_reader_t READER)
317 Read the next certificate from the READER object and store it in
318 the certificate object CERT for future access. The certificate is
319 parsed and rejected if it has any syntactical or semantical error
320 (i.e. does not match the ASN.1 description).
322 The function returns '0' if the operation was successfully
323 performed. An error code is returned on failure.
325 -- Function: gpg_error_t ksba_cert_init_from_mem (ksba_cert_t CERT,
326 const void *BUFFER, size_t LENGTH)
328 Parse the BUFFER which should contain a DER encoded certificate of
329 LENGTH and initialize the certificate object CERT with it. This
330 function is intended as a convenience function to be used when a
331 certificate is already available in a internal memory buffer. This
332 avoids the extra code needed to setup the reader object. Note that
333 CERT must be a valid certificate object.
335 The function returns '0' if the operation was successfully
336 performed. An error code is returned on failure.
339 File: ksba.info, Node: Retrieving attributes, Next: Setting attributes, Prev: Creating certificates, Up: Certificate Handling
341 3.2 How to get the attributes of a certificate
342 ==============================================
344 The functions in this section allow accessing the attributes of a
345 certificate in a well defined manner. An error will be returned if the
346 certificate object has not yet been initialized by means of
347 'ksba_cert_read_der' or 'ksba_cert_init_from_mem'.
349 -- Function: const unsigned char * ksba_cert_get_image
350 (ksba_cert_t CERT, size_t *R_LENGTH)
352 This function returns a pointer to the DER encoded buffer with the
353 raw certificate. The length of that buffer gets stored at
354 R_LENGTH. This function is useful to export or store the raw
357 The function returns 'NULL' on error or a pointer to a buffer with
358 the raw certificate data. That pointer is only valid as long as
359 the certificate object CERT is valid and has not been
362 -- Function: gpg_error_t ksba_cert_hash (ksba_cert_t CERT, int WHAT,
363 void (*HASHER)(void *, const void *, size_t length),
366 This function feeds the data which is expected to be hashed into
367 the supplied function HASHER, where the first argument passed is
368 HASHER_ARG, the second the pointer to the data to be hashed and the
369 third the length of this data.
371 The function returns '0' on success or an error code when something
372 goes wrong. The HASHER function is not expected to return an
373 error; instead the caller should setup that function in a way to
374 convey encountered errors by means of the HASHER_ARG. Note that a
375 hash function is in general not expected to yield errors anyway.
377 -- Function: const char * ksba_cert_get_digest_algo (ksba_cert_t CERT)
379 Figure out the the digest algorithm used for the signature and
380 return its OID in dotted decimal format. This function is most
381 likely used to setup the hash context before calling
382 'ksba_cert_hash'. For some certificate types the returned OID has
385 '1.2.840.113549.1.1.10'
386 This indicates the RSASSA-PSS algorithm. The digest algorithm
387 needs to be extracted from the S-expression returned by
388 'ksba_cert_get_sig_val'.
391 This is the Ed25519 algorithm which does not use a separate
392 digest algorithm. See RFC-8410.
395 This is the Ed448 algorithm which does not use a separate
396 digest algorithm. See RFC-8410.
398 The function returns 'NULL' for an error; on success a constant
399 string with the OID is returned. This string is valid as long the
400 certificate object is valid.
402 -- Function: ksba_sexp_t ksba_cert_get_serial (ksba_cert_t CERT)
404 The function returns the serial number of the certificate CERT.
405 The serial number is an integer returned as an canonical encoded
406 S-expression with just one element. The caller must free the
407 returned value. The value 'NULL' is returned in case of error.
409 -- Function: char * ksba_cert_get_issuer (ksba_cert_t CERT, int IDX)
411 With IDX given as '0', this function returns the Distinguished Name
412 (DN) of the certificate issuer; this usually is the name of a
413 certification authority (CA). The format of the returned string is
414 in accordance with RFC-2253. 'NULL' is returned if the DN is not
415 available; This is a severe error and actually should have been
416 caught by the certificate reading function.
418 With IDX greater than zero, the function may be used to enumerate
419 alternate issuer names. The function returns 'NULL' when there are
420 no more alternate names. Only alternate names recognized by
421 'libksba' are returned, others are simply skipped. The format of
422 the returned name is either a RFC-2253 formated string which can be
423 detected by checking whether the first character is a letter or
424 digit. RFC-822 conformant email addresses are returned enclosed in
425 angle brackets; the opening angle bracket should be used to detect
426 this. Other formats are returned as an S-Expression in canonical
427 format, so a opening parenthesis should be used to detect this
428 encoding. The name may include binary null characters, thus strlen
429 may return a length shorter than actually used. The real length is
430 implicitly given by the structure of the S-expression, an extra
431 null is appended for safety reasons.
433 The caller must free the returned string using 'ksba_free' or
434 whatever function has been registered as a replacement.
436 -- Function: char * ksba_cert_get_subject (ksba_cert_t CERT, int IDX)
438 With IDX given as '0', this function returns the Distinguished Name
439 (DN) of the certificate's subject. The format of the returned
440 string is in accordance with RFC-2253. 'NULL' is returned if the
443 With IDX greater than zero, the function may be used to enumerate
444 alternate subject names. The function returns 'NULL' when there
445 are no more alternate names. Only alternate names recognized by
446 'libksba' are returned, others are simply skipped. The format of
447 the returned name is either a RFC-2253 formated string which can be
448 detected by checking whether the first character is a letter or
449 digit. RFC-2822 conform email addresses are returned enclosed in
450 angle brackets; the opening angle bracket should be used to detect
451 this. Other formats are returned as an S-Expression in canonical
452 format, so a opening parenthesis should be used to detect this
453 encoding, the name may include binary null characters, thus strlen
454 may return a length shorter than actually used. The real length is
455 implicitly given by the structure of the S-expression, an extra
456 null is appended for safety reasons.
458 The caller must free the returned string using 'ksba_free' or
459 whatever function has been registered as a replacement.
461 -- Data type: ksba_isotime_t
462 Due to problems with the C data type 'time_t', which will overflow
463 on most 32 bit machines in the year 2038, it was not advisable to
464 use this type for referencing times stored in certificates.
465 Instead, you should use the 'ksba_isotime_t' type, which can
466 represent any time since the year 0.
468 It is implemented as a buffer of 16 bytes and may be handled like a
469 standard string. It should be initialized to zero (i.e. the first
470 byte needs to be 0x00) if it does not hold a valid date. Date
471 values themselves are stored in ISO format and assumed to be
472 referenced from UTC. The string with the date value is always
473 guaranteed to be of length 15 and having a format like:
474 '"19610711T172059"'. Note that the 'T' is required by ISO rules.
476 A simple assignment of these data types is not a good idea. You
477 may use 'strcpy' or better a specialized function like:
480 copy_time (ksba_isotime_t d, const ksba_isotime_t s)
488 For reasons of documentation a special function should also be used
489 to compare such times:
492 cmp_time (const ksba_isotime_t a, const ksba_isotime_t b)
494 return strcmp (a, b);
497 -- Function: gpg_error_t ksba_cert_get_validity
498 (ksba_cert_t CERT, int WHAT, ksba_isotime_t TIMEBUF)
500 Return the validity dates from the certificate. If no value is
501 available an empty date object (i.e. a 'strlen' will be stored at
502 TIMEBUF, otherwise it will receive the date. On failure an error
505 To return the 'notBefore' date, the value '0' must be supplied for
506 WHAT; '1' yields the 'notAfter' value.
508 -- Function: ksba_sexp_t ksba_cert_get_public_key (ksba_cert_t CERT)
510 [This needs to get written - for now please see libksba/src/cert.c]
512 -- Function: ksba_sexp_t ksba_cert_get_sig_val (ksba_cert_t CERT)
514 [This needs to get written - for now please see libksba/src/cert.c]
516 -- Function: gpg_error_t ksba_cert_get_extension
517 (ksba_cert_t CERT, int IDX, char const **R_OID, int *R_CRIT, size_t *R_DEROFF, size_t *R_DERLEN)
519 [This needs to get written - for now please see libksba/src/cert.c]
521 -- Function: gpg_error_t ksba_cert_is_ca
522 (ksba_cert_t CERT, int *R_CA, int *R_PATHLEN)
524 Return information on the basicConstraint (2.5.19.19) of CERT. R_CA
525 receives true if this is a CA and only in that case R_PATHLEN is
526 set to the maximum certification path length or -1 if there is no
529 -- Function: gpg_error_t ksba_cert_get_key_usage
530 (ksba_cert_t CERT, unsigned int *R_FLAGS)
532 Get the key usage flags. The function returns 'GPG_ERR_NO_DATA' if
533 no key usage is specified. The usage flags are as shown in
534 RFC3280, section 4.2.1.3. The key usage flags are represented by a
535 bitmask, and you can test each bit using symbolic constants, which
536 tells you if that usage is set on the certificate. The constants
539 'KSBA_KEYUSAGE_DIGITAL_SIGNATURE'
540 Usable for digitalSignature.
541 'KSBA_KEYUSAGE_NON_REPUDIATION'
542 Usable for nonRepudiation.
543 'KSBA_KEYUSAGE_KEY_ENCIPHERMENT'
544 Usable for keyEncipherment.
545 'KSBA_KEYUSAGE_DATA_ENCIPHERMENT'
546 Usable for dataEncipherment.
547 'KSBA_KEYUSAGE_KEY_AGREEMENT'
548 Usable for for keyAgreement.
549 'KSBA_KEYUSAGE_KEY_CERT_SIGN'
550 Usable for keyCertSign.
551 'KSBA_KEYUSAGE_CRL_SIGN'
553 'KSBA_KEYUSAGE_ENCIPHER_ONLY'
554 Usable for encipherOnly.
555 'KSBA_KEYUSAGE_DECIPHER_ONLY'
556 Usable for decipherOnly.
558 These are the basic constraints on usage of a certificate. If you
559 need to get additional constraints, see
560 'ksba_cert_get_ext_key_usages'.
562 -- Function: gpg_error_t ksba_cert_get_ext_key_usages
563 (ksba_cert_t CERT, char **RESULT)
565 Return a string containing the extended usages for the certificate,
566 delimited by linefeeds.
568 -- Function: gpg_error_t ksba_cert_get_cert_policies
569 (ksba_cert_t CERT, char **R_POLICIES)
571 Return a string with the certificatePolicies delimited by
572 linefeeds. The return values may be extended to carry more
573 information per line, so the caller should only use the first
574 white-space delimited token per line. The function returns
575 'GPG_ERR_NO_DATA' when this extension is not used. Caller must
576 free the returned value.
578 -- Function: gpg_error_t ksba_cert_get_crl_dist_point
579 (ksba_cert_t CERT, int IDX, ksba_name_t *R_DISTPOINT, ksba_name_t *R_ISSUER, unsigned int *R_REASON)
581 Return the CRLDistPoints given in the certificate extension of
582 certificate CERT. IDX should be iterated starting from 0 until the
583 function returns 'GPG_ERR_EOF'. R_DISTPOINT returns a ksba_name_t
584 object with the distribution point name(s); the return value may be
585 'NULL' to indicate that this name is not available. R_ISSUER
586 returns the CRL issuer; if the returned value is 'NULL' the caller
587 should assume that the CRL issuer is the same as the certificate
588 issuer. R_REASON returns the reason for the CRL. This is a bit
589 encoded value with no bit set if no reason has been specified in
592 The caller may pass 'NULL' to any of the pointer arguments if he is
593 not interested in this value. The return values for R_DISTPOINT
594 and R_ISSUER must be released by the caller using
597 -- Function: gpg_error_t ksba_cert_get_subj_key_id
598 (ksba_cert_t CERT, int *R_CRIT, ksba_sexp_t *R_KEYID)
600 Return the subjectKeyIdentifier extension as a simple allocated
601 S-expression at the address of R_KEYID. 0 is returned on success,
602 'GPG_ERR_NO_DATA' if no such extension is available or any other
603 error code. If R_CRIT is not passed as 'NULL', the critical flag
604 of this is extension is stored at this address.
606 -- Function: gpg_error_t ksba_cert_get_auth_key_id
607 (ksba_cert_t CERT, ksba_sexp_t *R_KEYID, ksba_name_t *R_NAME, ksba_sexp_t *R_SERIAL)
609 Return the authorityKeyIdentifier in R_NAME and R_SERIAL or in
610 R_KEYID. 'GPG_ERR_NO_DATA' is returned if no
611 authorityKeyIdentifier has been found. This error code is also
612 returned if R_KEYID has been given as NULL and only an
613 authorityKeyIdentifier with the keyIdentifier method is available.
615 -- Function: gpg_error_t ksba_cert_get_authority_info_access
616 (ksba_cert_t CERT, int IDX, char **R_METHOD, ksba_name_t *R_LOCATION)
618 Return the authorityInfoAccess attributes. IDX should be iterated
619 starting from 0 until this function returns 'GPG_ERR_EOF'.
620 R_METHOD returns an allocated string with the OID of one item and
621 R_LOCATION returns the GeneralName for that OID. The returned
622 values for R_METHOD and R_LOCATION must be released by the caller
623 unless the function returned an error; the function will however
624 make sure that R_METHOD and R_LOCATION will point to 'NULL' if the
625 function returns an error.
627 See RFC-2459, section 4.2.2.1 for the definition of this attribute.
629 -- Function: gpg_error_t ksba_cert_get_subject_info_access
630 (ksba_cert_t CERT, int IDX, char **R_METHOD, ksba_name_t *R_LOCATION)
632 Return the subjectInfoAccess attributes. IDX should be iterated
633 starting from 0 until this function returns 'GPG_ERR_EOF'.
634 R_METHOD returns an allocated string with the OID of one item and
635 R_LOCATION returns the GeneralName for that OID. The returned
636 values for R_METHOD and R_LOCATION must be released by the caller
637 unless the function returned an error; the function will however
638 make sure that R_METHOD and R_LOCATION will point to 'NULL' if the
639 function returns an error.
641 See RFC-2459, section 4.2.2.2 for the definition of this attribute.
644 File: ksba.info, Node: Setting attributes, Next: User data, Prev: Retrieving attributes, Up: Certificate Handling
646 3.3 How to set certificate attributes
647 =====================================
649 [This needs to be written. For example code see newpg/sm/sign.c]
652 File: ksba.info, Node: User data, Prev: Setting attributes, Up: Certificate Handling
654 3.4 How to associate other data with a certificate.
655 ===================================================
657 Certificate objects play a central role in many applications and often
658 it is desirable to associate other data with the certificate to avoid
659 wrapping the certificate object into an own object. 'KSBA' provides a
660 mechanism for this by means of two functions:
662 -- Function: gpg_error_t ksba_cert_set_user_data
663 (ksba_cert_t CERT, const char *KEY, const void *DATA, size_t DATALEN)
665 Stores arbitrary data along with a certificate. The data is
666 expected in the buffer DATA of length DATALEN. It will be stored
667 under the string KEY. If data is already stored under this key it
668 will be replaced by the new data. Using 'NULL' for DATA will
669 effectively delete the data.
671 On error (i.e. out of memory) an already existing data object
672 stored under KEY may get deleted.
674 *Caution:* This function is definitely not thread safe because we
675 don't employ any locking mechanisms.
677 -- Function: gpg_error_t ksba_cert_get_user_data (ksba_cert_t CERT,
678 const char *KEY, void *BUFFER, size_t BUFFERLEN,
681 Return user data for certificate CERT stored under the string KEY.
682 The caller needs to provide a suitable large BUFFER and the usable
683 length of this buffer in BUFFERLEN. If DATALEN is not 'NULL', the
684 length of the data stored in BUFFER will be stored there.
686 If BUFFER is given as 'NULL', BUFFERLEN will be ignored and the
687 required length of the buffer will be returned at DATALEN.
689 On success 0 is returned. If no data is stored under the given
690 key, 'GPG_ERR_NOT_FOUND' is returned. If the provided buffer is
691 too short and BUFFER is not 'NULL', 'GPG_ERR_BUFFER_TOO_SHORT' will
695 File: ksba.info, Node: CMS, Next: CRLs, Prev: Certificate Handling, Up: Top
697 4 Mastering the Cryptographic Message Syntax
698 ********************************************
700 The CMS is also known under the name PKCS#7. Is is a cryptographic
701 framework for securing data transactions and storage, much like OpenPGP.
702 It is heavily based on X.509 semantics and for example used with the
703 email encryption protocol S/MIME.
711 File: ksba.info, Node: CMS Basics, Next: CMS Parser, Up: CMS
716 All operations with the CMS framework require the use of a so called CMS
717 object which is internally used to keep track of the current state and
718 to store some meta information.
720 -- Data type: ksba_cms_t
721 The 'ksba_cms_t' type is used for this CMS object.
722 -- Data type: ksba_stop_reason_t
723 The 'ksba_stop_reason_t' type is an enumeration used for
724 communication between the phases of a parsing or building process.
726 -- Function: ksba_cms_t ksba_cms_new (void)
728 This function creates a new CMS object. The only reason the
729 function may fail is an out-of-memory condition in which case
730 'NULL' is returned. It is safe for the caller to translate this to
731 the standard error code 'GPG_ERR_ENOMEM'. Any object created with
732 this function should be released after use by using
735 -- Function: void ksba_cms_release (ksba_cms_t CMS)
737 Release all resources associated with the CMS object. It is
738 perfectly okay to pass 'NULL' to this function in which case
741 -- Function: gpg_error_t ksba_cms_set_reader_writer
742 (ksba_cms_t CMS, ksba_reader_t R, ksba_writer_t W)
744 About all usages of the CMS framework require some input and output
745 data (great surprise!). To accomplish this in the most abstract
746 way, no direct output functions are used - instead special reader
747 and writer objects are used instead. Depending on the desired
748 operations either a reader, a writer or both must be given.
749 Associate a reader object with CMS by passing it as R and a writer
750 object by passing it as W. Note that no reference counting is
751 done,so make sure that those objects have a lifetime at least as
754 If you forget to set these objects, you will get an appropriate
755 error later when data is actually to be read or written. The
756 function returns zero on success or an error code when invalid
760 File: ksba.info, Node: CMS Parser, Prev: CMS Basics, Up: CMS
765 KSBA includes a versatile CMS parser for encryption (enveloped data) and
766 digital signing. The parser is capable of handling arbitrary amounts of
767 data without requiring much memory. Well, certain objects are build in
768 memory because it can be assumed that those objects are limited in size;
769 e.g. it does not make sense to use a video clip as the DN despite the
770 fact that the standard does not forbid it.
772 -- Function: gpg_error_t ksba_cms_parse
773 (ksba_cms_t CMS, ksba_stop_reason_t *R_STOPREASON)
775 This is the core function of the parser and commonly used in a
776 loop. The parsing process is divided into several phases to allow
777 the user to get information at the right time and prepare for
778 further processing. The caller has to act on certain stop reasons
779 which are returned by R_STOPREASON and set up things accordingly;
780 KSBA may introduce new stop reasons to let the caller know other
781 details; there is no need for the caller to act on every stop
782 reason; it should only do so for reasons that the caller
783 understands and which are mandatory. The function will return with
784 an error if the caller did not setup things correctly for certain
787 The use of this function is best explained by an example, leaving out
791 ksba_cms_parse (cms, &stopreason);
792 if (stopreason == KSBA_SR_BEGIN_DATA)
795 decrypt_session_key ();
796 setup_bulk_decryption ();
798 else if (stopreason == KSBA_SR_END_DATA)
803 while (stopreason != KSBA_SR_READY);
804 This function assumes that the parsed data is so called 'enveloped
807 As CMS provides a common framework for a variety of data formats, it
808 is probably very useful to check the type of that data very early. This
809 can be accomplished by hooking into the stop reason
810 'KSBA_SR_GOT_CONTENT' and retrieving the content using the following
813 -- Function: ksba_content_t ksba_cms_get_content_type
814 (ksba_cms_t CMS, int WHAT)
816 By using a value of '0' for WHAT this function returns the content
817 type of the outer container; using '1' does return the content type
818 of the enclosed object.
820 -- Data type: ksba_content_t
821 The 'ksba_content_t' type is an enumeration used to describe
822 the content of a CMS message. Here is a list of possible
826 No content type known (value '0')
829 The content is plain data, not further interpreted.
831 'KSBA_CT_SIGNED_DATA'
832 The content is an signed CMS object. This also includes
833 the case of a detached signature where no actual data is
834 included in the message.
836 'KSBA_CT_ENVELOPED_DATA'
837 The content is encrypted using a session key.
839 'KSBA_CT_DIGESTED_DATA'
842 'KSBA_CT_ENCRYPTED_DATA'
848 -- Function: const char * ksba_cms_get_content_oid
849 (ksba_cms_t CMS, int WHAT)
851 Return the object ID of CMS. This is a constant string valid as
852 long as the context is valid and no new parse is started. This
853 function is similar to 'ksba_cms_get_content_type' but returns the
854 OID actually used in the data. Depending on the value of WHAT
855 different values are returned: Using a value of '0' yields the OID
856 of the outer container, a value of '1' yields the OID of the inner
857 container if available and the value '2' returns the OID of the
858 algorithm used to encrypt the inner container.
861 File: ksba.info, Node: CRLs, Next: PKCS10, Prev: CMS, Up: Top
863 5 Certification Revocation Lists
864 ********************************
866 KSBA also comes with an API to process certification revocation lists.
867 The API is similar to the CMS one but returns the contents entry by
871 File: ksba.info, Node: PKCS10, Next: Utilities, Prev: CRLs, Up: Top
873 6 Certification Requests
874 ************************
876 When using decentral generated keys, it is necessary to send out special
877 formated messages so that a CA can generate the certificate.
880 File: ksba.info, Node: Utilities, Next: Error Handling, Prev: PKCS10, Up: Top
885 A few utility function and objects are available. Some of them must be
886 used to support some of the main functions.
890 * Names:: General Names object
891 * OIDs:: Object Identifier helpers
892 * DNs:: Distinguished Name helpers
895 File: ksba.info, Node: Names, Next: OIDs, Up: Utilities
897 7.1 General Names object
898 ========================
900 This is an object to handle some of the names used in X.509. We need
901 this object approach because those names may come as a set and there is
902 no other clean way to access them.
904 -- Data type: ksba_name_t
905 The 'ksba_name_t' type is an object to represent names sets.
907 -- Function: void ksba_name_release (ksba_name_t NAME)
909 This function releases the object NAME. Passing 'NULL' is allowed.
911 -- Function: const char * ksba_name_enum (ksba_name_t NAME, int IDX)
913 By iterating IDX up starting with 0, this function returns all
914 General Names stored in NAME. The format of the returned name is
915 either a RFC-2253 formated one which can be detected by checking
916 whether the first character is letter or a digit. RFC 2822
917 conformant email addresses are returned enclosed in angle brackets,
918 the opening angle bracket should be used to detect this. Other
919 formats are returned as an S-Expression in canonical format, so an
920 opening parenthesis may be used to detect this encoding, in this
921 case the name may include binary null characters, so strlen might
922 return a length shorter than actually used, the real length is
923 implicitly given by the structure of the S-Exp, an extra null is
924 appended for safety reasons. One common format return is a
925 Universal Resource Identifier which has the S-expression: '(uri
928 The returned string has the same lifetime as NAME.
930 -- Function: char * ksba_name_get_uri (ksba_name_t NAME, int IDX)
932 Convenience function to return names representing an URI. Caller
933 must free the returned value. Note that this function should not
934 be used to enumerate the names.
936 Here is an example on how you can use this function to enumerate
940 print_names (ksba_name_t name)
945 for (idx=0; (s = ksba_name_enum (name, idx)); idx++)
947 char *p = ksba_name_get_uri (name, idx);
957 File: ksba.info, Node: OIDs, Next: DNs, Prev: Names, Up: Utilities
959 7.2 Object Identifier helpers
960 =============================
962 [This needs to get written - for now please see libksba/src/oids.c]
965 File: ksba.info, Node: DNs, Prev: OIDs, Up: Utilities
967 7.3 Distinguished Name helpers
968 ==============================
970 These are helper functions for the so called distinguished names. They
971 are used for example as the issuer and subject name.
973 -- Function: gpg_error_t ksba_dn_teststr (const char *STRING, int SEQ,
974 size_t *RERROFF, size_t *RERRLEN)
976 Assuming that STRING contains an RFC-2253 encoded string, test
977 whether this string may be passed as a valid DN to libksba. On
978 success the functions returns '0'. On error the function returns
979 an error code and stores the offset of the erroneous part at
980 RERROFF. RERRLEN will then receive the length of the erroneous
983 This function is mostly useful to test whether a certain component
984 label is supported. SEQ should be passed as '0' for now. Any of
985 RERROFF and RERRLEN may be passed as NULL if the caller is not
986 interested at this value.
988 gpg_error_t ksba_dn_str2der (const char *string, void **rder, size_t
991 gpg_error_t ksba_dn_der2str (const void *der, size_t derlen, char
995 File: ksba.info, Node: Error Handling, Next: Component Labels, Prev: Utilities, Up: Top
1000 Most functions in 'KSBA' will return an error if they fail. For this
1001 reason, the application should always catch the error condition and take
1002 appropriate measures, for example by releasing the resources and passing
1003 the error up to the caller, or by displaying a descriptive message to
1004 the user and canceling the operation.
1006 Some error values do not indicate a system error or an error in the
1007 operation, but the reasonable result of an operation. For example, if
1008 you try to access optional attributes of a certificate that are not
1009 present, you get an appropriate error message. Some error values have
1010 specific meanings if returned by a specific function. Such cases are
1011 described in the documentation of those functions.
1013 All error codes are defined by the library 'libgpg-error'. See there
1014 for ways to check the error values and print descriptive strings.
1015 Please be aware that you can't check directly against an error code but
1016 have to do it like this:
1019 if (gpg_err_code (err) == GPG_ERR_EOF)
1022 The only exception is that success (i.e. no error) is defined to be
1023 '0'; thus you may directly test for success like:
1029 File: ksba.info, Node: Component Labels, Next: Copying, Prev: Error Handling, Up: Top
1031 Appendix A Component Labels
1032 ***************************
1034 RFC-2253 defines the following table with string representations of name
1038 C countryName 2.5.4.6
1039 CN commonName 2.5.4.3
1040 DC domainComponent 0.9.2342.19200300.100.1.25
1041 L localityName 2.5.4.7
1042 O organizationName 2.5.4.10
1043 OU organizationalUnit 2.5.4.11
1044 ST stateOrProvince 2.5.4.8
1045 STREET streetAddress 2.5.4.9
1046 UID userid 0.9.2342.19200300.100.1.1
1049 They are used internally for converting a DN into its string
1050 representation; components not listed in this table will be represented
1053 For the other direction, i.e. creating a DN from the string
1054 representation, KSBA recognizes the following extra labels:
1057 ADDR postalAddress 2.5.4.16
1058 BC businessCategory 2.5.4.15
1059 D description 2.5.4.13
1060 EMAIL emailAddress 1.2.840.113549.1.9.1
1061 GN givenName 2.5.4.42
1062 POSTALCODE postalCode 2.5.4.17
1063 PSEUDO pseudonym 2.5.4.65
1064 SERIALNUMBER serialNumber 2.5.4.5
1070 File: ksba.info, Node: Copying, Next: Concept Index, Prev: Component Labels, Up: Top
1072 GNU General Public License
1073 **************************
1075 Version 3, 29 June 2007
1077 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
1079 Everyone is permitted to copy and distribute verbatim copies of this
1080 license document, but changing it is not allowed.
1085 The GNU General Public License is a free, copyleft license for software
1086 and other kinds of works.
1088 The licenses for most software and other practical works are designed
1089 to take away your freedom to share and change the works. By contrast,
1090 the GNU General Public License is intended to guarantee your freedom to
1091 share and change all versions of a program-to make sure it remains free
1092 software for all its users. We, the Free Software Foundation, use the
1093 GNU General Public License for most of our software; it applies also to
1094 any other work released this way by its authors. You can apply it to
1097 When we speak of free software, we are referring to freedom, not
1098 price. Our General Public Licenses are designed to make sure that you
1099 have the freedom to distribute copies of free software (and charge for
1100 them if you wish), that you receive source code or can get it if you
1101 want it, that you can change the software or use pieces of it in new
1102 free programs, and that you know you can do these things.
1104 To protect your rights, we need to prevent others from denying you
1105 these rights or asking you to surrender the rights. Therefore, you have
1106 certain responsibilities if you distribute copies of the software, or if
1107 you modify it: responsibilities to respect the freedom of others.
1109 For example, if you distribute copies of such a program, whether
1110 gratis or for a fee, you must pass on to the recipients the same
1111 freedoms that you received. You must make sure that they, too, receive
1112 or can get the source code. And you must show them these terms so they
1115 Developers that use the GNU GPL protect your rights with two steps:
1116 (1) assert copyright on the software, and (2) offer you this License
1117 giving you legal permission to copy, distribute and/or modify it.
1119 For the developers' and authors' protection, the GPL clearly explains
1120 that there is no warranty for this free software. For both users' and
1121 authors' sake, the GPL requires that modified versions be marked as
1122 changed, so that their problems will not be attributed erroneously to
1123 authors of previous versions.
1125 Some devices are designed to deny users access to install or run
1126 modified versions of the software inside them, although the manufacturer
1127 can do so. This is fundamentally incompatible with the aim of
1128 protecting users' freedom to change the software. The systematic
1129 pattern of such abuse occurs in the area of products for individuals to
1130 use, which is precisely where it is most unacceptable. Therefore, we
1131 have designed this version of the GPL to prohibit the practice for those
1132 products. If such problems arise substantially in other domains, we
1133 stand ready to extend this provision to those domains in future versions
1134 of the GPL, as needed to protect the freedom of users.
1136 Finally, every program is threatened constantly by software patents.
1137 States should not allow patents to restrict development and use of
1138 software on general-purpose computers, but in those that do, we wish to
1139 avoid the special danger that patents applied to a free program could
1140 make it effectively proprietary. To prevent this, the GPL assures that
1141 patents cannot be used to render the program non-free.
1143 The precise terms and conditions for copying, distribution and
1144 modification follow.
1146 TERMS AND CONDITIONS
1150 "This License" refers to version 3 of the GNU General Public
1153 "Copyright" also means copyright-like laws that apply to other
1154 kinds of works, such as semiconductor masks.
1156 "The Program" refers to any copyrightable work licensed under this
1157 License. Each licensee is addressed as "you". "Licensees" and
1158 "recipients" may be individuals or organizations.
1160 To "modify" a work means to copy from or adapt all or part of the
1161 work in a fashion requiring copyright permission, other than the
1162 making of an exact copy. The resulting work is called a "modified
1163 version" of the earlier work or a work "based on" the earlier work.
1165 A "covered work" means either the unmodified Program or a work
1166 based on the Program.
1168 To "propagate" a work means to do anything with it that, without
1169 permission, would make you directly or secondarily liable for
1170 infringement under applicable copyright law, except executing it on
1171 a computer or modifying a private copy. Propagation includes
1172 copying, distribution (with or without modification), making
1173 available to the public, and in some countries other activities as
1176 To "convey" a work means any kind of propagation that enables other
1177 parties to make or receive copies. Mere interaction with a user
1178 through a computer network, with no transfer of a copy, is not
1181 An interactive user interface displays "Appropriate Legal Notices"
1182 to the extent that it includes a convenient and prominently visible
1183 feature that (1) displays an appropriate copyright notice, and (2)
1184 tells the user that there is no warranty for the work (except to
1185 the extent that warranties are provided), that licensees may convey
1186 the work under this License, and how to view a copy of this
1187 License. If the interface presents a list of user commands or
1188 options, such as a menu, a prominent item in the list meets this
1193 The "source code" for a work means the preferred form of the work
1194 for making modifications to it. "Object code" means any non-source
1197 A "Standard Interface" means an interface that either is an
1198 official standard defined by a recognized standards body, or, in
1199 the case of interfaces specified for a particular programming
1200 language, one that is widely used among developers working in that
1203 The "System Libraries" of an executable work include anything,
1204 other than the work as a whole, that (a) is included in the normal
1205 form of packaging a Major Component, but which is not part of that
1206 Major Component, and (b) serves only to enable use of the work with
1207 that Major Component, or to implement a Standard Interface for
1208 which an implementation is available to the public in source code
1209 form. A "Major Component", in this context, means a major
1210 essential component (kernel, window system, and so on) of the
1211 specific operating system (if any) on which the executable work
1212 runs, or a compiler used to produce the work, or an object code
1213 interpreter used to run it.
1215 The "Corresponding Source" for a work in object code form means all
1216 the source code needed to generate, install, and (for an executable
1217 work) run the object code and to modify the work, including scripts
1218 to control those activities. However, it does not include the
1219 work's System Libraries, or general-purpose tools or generally
1220 available free programs which are used unmodified in performing
1221 those activities but which are not part of the work. For example,
1222 Corresponding Source includes interface definition files associated
1223 with source files for the work, and the source code for shared
1224 libraries and dynamically linked subprograms that the work is
1225 specifically designed to require, such as by intimate data
1226 communication or control flow between those subprograms and other
1229 The Corresponding Source need not include anything that users can
1230 regenerate automatically from other parts of the Corresponding
1233 The Corresponding Source for a work in source code form is that
1236 2. Basic Permissions.
1238 All rights granted under this License are granted for the term of
1239 copyright on the Program, and are irrevocable provided the stated
1240 conditions are met. This License explicitly affirms your unlimited
1241 permission to run the unmodified Program. The output from running
1242 a covered work is covered by this License only if the output, given
1243 its content, constitutes a covered work. This License acknowledges
1244 your rights of fair use or other equivalent, as provided by
1247 You may make, run and propagate covered works that you do not
1248 convey, without conditions so long as your license otherwise
1249 remains in force. You may convey covered works to others for the
1250 sole purpose of having them make modifications exclusively for you,
1251 or provide you with facilities for running those works, provided
1252 that you comply with the terms of this License in conveying all
1253 material for which you do not control copyright. Those thus making
1254 or running the covered works for you must do so exclusively on your
1255 behalf, under your direction and control, on terms that prohibit
1256 them from making any copies of your copyrighted material outside
1257 their relationship with you.
1259 Conveying under any other circumstances is permitted solely under
1260 the conditions stated below. Sublicensing is not allowed; section
1261 10 makes it unnecessary.
1263 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
1265 No covered work shall be deemed part of an effective technological
1266 measure under any applicable law fulfilling obligations under
1267 article 11 of the WIPO copyright treaty adopted on 20 December
1268 1996, or similar laws prohibiting or restricting circumvention of
1271 When you convey a covered work, you waive any legal power to forbid
1272 circumvention of technological measures to the extent such
1273 circumvention is effected by exercising rights under this License
1274 with respect to the covered work, and you disclaim any intention to
1275 limit operation or modification of the work as a means of
1276 enforcing, against the work's users, your or third parties' legal
1277 rights to forbid circumvention of technological measures.
1279 4. Conveying Verbatim Copies.
1281 You may convey verbatim copies of the Program's source code as you
1282 receive it, in any medium, provided that you conspicuously and
1283 appropriately publish on each copy an appropriate copyright notice;
1284 keep intact all notices stating that this License and any
1285 non-permissive terms added in accord with section 7 apply to the
1286 code; keep intact all notices of the absence of any warranty; and
1287 give all recipients a copy of this License along with the Program.
1289 You may charge any price or no price for each copy that you convey,
1290 and you may offer support or warranty protection for a fee.
1292 5. Conveying Modified Source Versions.
1294 You may convey a work based on the Program, or the modifications to
1295 produce it from the Program, in the form of source code under the
1296 terms of section 4, provided that you also meet all of these
1299 a. The work must carry prominent notices stating that you
1300 modified it, and giving a relevant date.
1302 b. The work must carry prominent notices stating that it is
1303 released under this License and any conditions added under
1304 section 7. This requirement modifies the requirement in
1305 section 4 to "keep intact all notices".
1307 c. You must license the entire work, as a whole, under this
1308 License to anyone who comes into possession of a copy. This
1309 License will therefore apply, along with any applicable
1310 section 7 additional terms, to the whole of the work, and all
1311 its parts, regardless of how they are packaged. This License
1312 gives no permission to license the work in any other way, but
1313 it does not invalidate such permission if you have separately
1316 d. If the work has interactive user interfaces, each must display
1317 Appropriate Legal Notices; however, if the Program has
1318 interactive interfaces that do not display Appropriate Legal
1319 Notices, your work need not make them do so.
1321 A compilation of a covered work with other separate and independent
1322 works, which are not by their nature extensions of the covered
1323 work, and which are not combined with it such as to form a larger
1324 program, in or on a volume of a storage or distribution medium, is
1325 called an "aggregate" if the compilation and its resulting
1326 copyright are not used to limit the access or legal rights of the
1327 compilation's users beyond what the individual works permit.
1328 Inclusion of a covered work in an aggregate does not cause this
1329 License to apply to the other parts of the aggregate.
1331 6. Conveying Non-Source Forms.
1333 You may convey a covered work in object code form under the terms
1334 of sections 4 and 5, provided that you also convey the
1335 machine-readable Corresponding Source under the terms of this
1336 License, in one of these ways:
1338 a. Convey the object code in, or embodied in, a physical product
1339 (including a physical distribution medium), accompanied by the
1340 Corresponding Source fixed on a durable physical medium
1341 customarily used for software interchange.
1343 b. Convey the object code in, or embodied in, a physical product
1344 (including a physical distribution medium), accompanied by a
1345 written offer, valid for at least three years and valid for as
1346 long as you offer spare parts or customer support for that
1347 product model, to give anyone who possesses the object code
1348 either (1) a copy of the Corresponding Source for all the
1349 software in the product that is covered by this License, on a
1350 durable physical medium customarily used for software
1351 interchange, for a price no more than your reasonable cost of
1352 physically performing this conveying of source, or (2) access
1353 to copy the Corresponding Source from a network server at no
1356 c. Convey individual copies of the object code with a copy of the
1357 written offer to provide the Corresponding Source. This
1358 alternative is allowed only occasionally and noncommercially,
1359 and only if you received the object code with such an offer,
1360 in accord with subsection 6b.
1362 d. Convey the object code by offering access from a designated
1363 place (gratis or for a charge), and offer equivalent access to
1364 the Corresponding Source in the same way through the same
1365 place at no further charge. You need not require recipients
1366 to copy the Corresponding Source along with the object code.
1367 If the place to copy the object code is a network server, the
1368 Corresponding Source may be on a different server (operated by
1369 you or a third party) that supports equivalent copying
1370 facilities, provided you maintain clear directions next to the
1371 object code saying where to find the Corresponding Source.
1372 Regardless of what server hosts the Corresponding Source, you
1373 remain obligated to ensure that it is available for as long as
1374 needed to satisfy these requirements.
1376 e. Convey the object code using peer-to-peer transmission,
1377 provided you inform other peers where the object code and
1378 Corresponding Source of the work are being offered to the
1379 general public at no charge under subsection 6d.
1381 A separable portion of the object code, whose source code is
1382 excluded from the Corresponding Source as a System Library, need
1383 not be included in conveying the object code work.
1385 A "User Product" is either (1) a "consumer product", which means
1386 any tangible personal property which is normally used for personal,
1387 family, or household purposes, or (2) anything designed or sold for
1388 incorporation into a dwelling. In determining whether a product is
1389 a consumer product, doubtful cases shall be resolved in favor of
1390 coverage. For a particular product received by a particular user,
1391 "normally used" refers to a typical or common use of that class of
1392 product, regardless of the status of the particular user or of the
1393 way in which the particular user actually uses, or expects or is
1394 expected to use, the product. A product is a consumer product
1395 regardless of whether the product has substantial commercial,
1396 industrial or non-consumer uses, unless such uses represent the
1397 only significant mode of use of the product.
1399 "Installation Information" for a User Product means any methods,
1400 procedures, authorization keys, or other information required to
1401 install and execute modified versions of a covered work in that
1402 User Product from a modified version of its Corresponding Source.
1403 The information must suffice to ensure that the continued
1404 functioning of the modified object code is in no case prevented or
1405 interfered with solely because modification has been made.
1407 If you convey an object code work under this section in, or with,
1408 or specifically for use in, a User Product, and the conveying
1409 occurs as part of a transaction in which the right of possession
1410 and use of the User Product is transferred to the recipient in
1411 perpetuity or for a fixed term (regardless of how the transaction
1412 is characterized), the Corresponding Source conveyed under this
1413 section must be accompanied by the Installation Information. But
1414 this requirement does not apply if neither you nor any third party
1415 retains the ability to install modified object code on the User
1416 Product (for example, the work has been installed in ROM).
1418 The requirement to provide Installation Information does not
1419 include a requirement to continue to provide support service,
1420 warranty, or updates for a work that has been modified or installed
1421 by the recipient, or for the User Product in which it has been
1422 modified or installed. Access to a network may be denied when the
1423 modification itself materially and adversely affects the operation
1424 of the network or violates the rules and protocols for
1425 communication across the network.
1427 Corresponding Source conveyed, and Installation Information
1428 provided, in accord with this section must be in a format that is
1429 publicly documented (and with an implementation available to the
1430 public in source code form), and must require no special password
1431 or key for unpacking, reading or copying.
1433 7. Additional Terms.
1435 "Additional permissions" are terms that supplement the terms of
1436 this License by making exceptions from one or more of its
1437 conditions. Additional permissions that are applicable to the
1438 entire Program shall be treated as though they were included in
1439 this License, to the extent that they are valid under applicable
1440 law. If additional permissions apply only to part of the Program,
1441 that part may be used separately under those permissions, but the
1442 entire Program remains governed by this License without regard to
1443 the additional permissions.
1445 When you convey a copy of a covered work, you may at your option
1446 remove any additional permissions from that copy, or from any part
1447 of it. (Additional permissions may be written to require their own
1448 removal in certain cases when you modify the work.) You may place
1449 additional permissions on material, added by you to a covered work,
1450 for which you have or can give appropriate copyright permission.
1452 Notwithstanding any other provision of this License, for material
1453 you add to a covered work, you may (if authorized by the copyright
1454 holders of that material) supplement the terms of this License with
1457 a. Disclaiming warranty or limiting liability differently from
1458 the terms of sections 15 and 16 of this License; or
1460 b. Requiring preservation of specified reasonable legal notices
1461 or author attributions in that material or in the Appropriate
1462 Legal Notices displayed by works containing it; or
1464 c. Prohibiting misrepresentation of the origin of that material,
1465 or requiring that modified versions of such material be marked
1466 in reasonable ways as different from the original version; or
1468 d. Limiting the use for publicity purposes of names of licensors
1469 or authors of the material; or
1471 e. Declining to grant rights under trademark law for use of some
1472 trade names, trademarks, or service marks; or
1474 f. Requiring indemnification of licensors and authors of that
1475 material by anyone who conveys the material (or modified
1476 versions of it) with contractual assumptions of liability to
1477 the recipient, for any liability that these contractual
1478 assumptions directly impose on those licensors and authors.
1480 All other non-permissive additional terms are considered "further
1481 restrictions" within the meaning of section 10. If the Program as
1482 you received it, or any part of it, contains a notice stating that
1483 it is governed by this License along with a term that is a further
1484 restriction, you may remove that term. If a license document
1485 contains a further restriction but permits relicensing or conveying
1486 under this License, you may add to a covered work material governed
1487 by the terms of that license document, provided that the further
1488 restriction does not survive such relicensing or conveying.
1490 If you add terms to a covered work in accord with this section, you
1491 must place, in the relevant source files, a statement of the
1492 additional terms that apply to those files, or a notice indicating
1493 where to find the applicable terms.
1495 Additional terms, permissive or non-permissive, may be stated in
1496 the form of a separately written license, or stated as exceptions;
1497 the above requirements apply either way.
1501 You may not propagate or modify a covered work except as expressly
1502 provided under this License. Any attempt otherwise to propagate or
1503 modify it is void, and will automatically terminate your rights
1504 under this License (including any patent licenses granted under the
1505 third paragraph of section 11).
1507 However, if you cease all violation of this License, then your
1508 license from a particular copyright holder is reinstated (a)
1509 provisionally, unless and until the copyright holder explicitly and
1510 finally terminates your license, and (b) permanently, if the
1511 copyright holder fails to notify you of the violation by some
1512 reasonable means prior to 60 days after the cessation.
1514 Moreover, your license from a particular copyright holder is
1515 reinstated permanently if the copyright holder notifies you of the
1516 violation by some reasonable means, this is the first time you have
1517 received notice of violation of this License (for any work) from
1518 that copyright holder, and you cure the violation prior to 30 days
1519 after your receipt of the notice.
1521 Termination of your rights under this section does not terminate
1522 the licenses of parties who have received copies or rights from you
1523 under this License. If your rights have been terminated and not
1524 permanently reinstated, you do not qualify to receive new licenses
1525 for the same material under section 10.
1527 9. Acceptance Not Required for Having Copies.
1529 You are not required to accept this License in order to receive or
1530 run a copy of the Program. Ancillary propagation of a covered work
1531 occurring solely as a consequence of using peer-to-peer
1532 transmission to receive a copy likewise does not require
1533 acceptance. However, nothing other than this License grants you
1534 permission to propagate or modify any covered work. These actions
1535 infringe copyright if you do not accept this License. Therefore,
1536 by modifying or propagating a covered work, you indicate your
1537 acceptance of this License to do so.
1539 10. Automatic Licensing of Downstream Recipients.
1541 Each time you convey a covered work, the recipient automatically
1542 receives a license from the original licensors, to run, modify and
1543 propagate that work, subject to this License. You are not
1544 responsible for enforcing compliance by third parties with this
1547 An "entity transaction" is a transaction transferring control of an
1548 organization, or substantially all assets of one, or subdividing an
1549 organization, or merging organizations. If propagation of a
1550 covered work results from an entity transaction, each party to that
1551 transaction who receives a copy of the work also receives whatever
1552 licenses to the work the party's predecessor in interest had or
1553 could give under the previous paragraph, plus a right to possession
1554 of the Corresponding Source of the work from the predecessor in
1555 interest, if the predecessor has it or can get it with reasonable
1558 You may not impose any further restrictions on the exercise of the
1559 rights granted or affirmed under this License. For example, you
1560 may not impose a license fee, royalty, or other charge for exercise
1561 of rights granted under this License, and you may not initiate
1562 litigation (including a cross-claim or counterclaim in a lawsuit)
1563 alleging that any patent claim is infringed by making, using,
1564 selling, offering for sale, or importing the Program or any portion
1569 A "contributor" is a copyright holder who authorizes use under this
1570 License of the Program or a work on which the Program is based.
1571 The work thus licensed is called the contributor's "contributor
1574 A contributor's "essential patent claims" are all patent claims
1575 owned or controlled by the contributor, whether already acquired or
1576 hereafter acquired, that would be infringed by some manner,
1577 permitted by this License, of making, using, or selling its
1578 contributor version, but do not include claims that would be
1579 infringed only as a consequence of further modification of the
1580 contributor version. For purposes of this definition, "control"
1581 includes the right to grant patent sublicenses in a manner
1582 consistent with the requirements of this License.
1584 Each contributor grants you a non-exclusive, worldwide,
1585 royalty-free patent license under the contributor's essential
1586 patent claims, to make, use, sell, offer for sale, import and
1587 otherwise run, modify and propagate the contents of its contributor
1590 In the following three paragraphs, a "patent license" is any
1591 express agreement or commitment, however denominated, not to
1592 enforce a patent (such as an express permission to practice a
1593 patent or covenant not to sue for patent infringement). To "grant"
1594 such a patent license to a party means to make such an agreement or
1595 commitment not to enforce a patent against the party.
1597 If you convey a covered work, knowingly relying on a patent
1598 license, and the Corresponding Source of the work is not available
1599 for anyone to copy, free of charge and under the terms of this
1600 License, through a publicly available network server or other
1601 readily accessible means, then you must either (1) cause the
1602 Corresponding Source to be so available, or (2) arrange to deprive
1603 yourself of the benefit of the patent license for this particular
1604 work, or (3) arrange, in a manner consistent with the requirements
1605 of this License, to extend the patent license to downstream
1606 recipients. "Knowingly relying" means you have actual knowledge
1607 that, but for the patent license, your conveying the covered work
1608 in a country, or your recipient's use of the covered work in a
1609 country, would infringe one or more identifiable patents in that
1610 country that you have reason to believe are valid.
1612 If, pursuant to or in connection with a single transaction or
1613 arrangement, you convey, or propagate by procuring conveyance of, a
1614 covered work, and grant a patent license to some of the parties
1615 receiving the covered work authorizing them to use, propagate,
1616 modify or convey a specific copy of the covered work, then the
1617 patent license you grant is automatically extended to all
1618 recipients of the covered work and works based on it.
1620 A patent license is "discriminatory" if it does not include within
1621 the scope of its coverage, prohibits the exercise of, or is
1622 conditioned on the non-exercise of one or more of the rights that
1623 are specifically granted under this License. You may not convey a
1624 covered work if you are a party to an arrangement with a third
1625 party that is in the business of distributing software, under which
1626 you make payment to the third party based on the extent of your
1627 activity of conveying the work, and under which the third party
1628 grants, to any of the parties who would receive the covered work
1629 from you, a discriminatory patent license (a) in connection with
1630 copies of the covered work conveyed by you (or copies made from
1631 those copies), or (b) primarily for and in connection with specific
1632 products or compilations that contain the covered work, unless you
1633 entered into that arrangement, or that patent license was granted,
1634 prior to 28 March 2007.
1636 Nothing in this License shall be construed as excluding or limiting
1637 any implied license or other defenses to infringement that may
1638 otherwise be available to you under applicable patent law.
1640 12. No Surrender of Others' Freedom.
1642 If conditions are imposed on you (whether by court order, agreement
1643 or otherwise) that contradict the conditions of this License, they
1644 do not excuse you from the conditions of this License. If you
1645 cannot convey a covered work so as to satisfy simultaneously your
1646 obligations under this License and any other pertinent obligations,
1647 then as a consequence you may not convey it at all. For example,
1648 if you agree to terms that obligate you to collect a royalty for
1649 further conveying from those to whom you convey the Program, the
1650 only way you could satisfy both those terms and this License would
1651 be to refrain entirely from conveying the Program.
1653 13. Use with the GNU Affero General Public License.
1655 Notwithstanding any other provision of this License, you have
1656 permission to link or combine any covered work with a work licensed
1657 under version 3 of the GNU Affero General Public License into a
1658 single combined work, and to convey the resulting work. The terms
1659 of this License will continue to apply to the part which is the
1660 covered work, but the special requirements of the GNU Affero
1661 General Public License, section 13, concerning interaction through
1662 a network will apply to the combination as such.
1664 14. Revised Versions of this License.
1666 The Free Software Foundation may publish revised and/or new
1667 versions of the GNU General Public License from time to time. Such
1668 new versions will be similar in spirit to the present version, but
1669 may differ in detail to address new problems or concerns.
1671 Each version is given a distinguishing version number. If the
1672 Program specifies that a certain numbered version of the GNU
1673 General Public License "or any later version" applies to it, you
1674 have the option of following the terms and conditions either of
1675 that numbered version or of any later version published by the Free
1676 Software Foundation. If the Program does not specify a version
1677 number of the GNU General Public License, you may choose any
1678 version ever published by the Free Software Foundation.
1680 If the Program specifies that a proxy can decide which future
1681 versions of the GNU General Public License can be used, that
1682 proxy's public statement of acceptance of a version permanently
1683 authorizes you to choose that version for the Program.
1685 Later license versions may give you additional or different
1686 permissions. However, no additional obligations are imposed on any
1687 author or copyright holder as a result of your choosing to follow a
1690 15. Disclaimer of Warranty.
1692 THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
1693 APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE
1694 COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS"
1695 WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
1696 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1697 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE
1698 RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.
1699 SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
1700 NECESSARY SERVICING, REPAIR OR CORRECTION.
1702 16. Limitation of Liability.
1704 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
1705 WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES
1706 AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
1707 DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
1708 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
1709 THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
1710 BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
1711 PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
1712 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF
1713 THE POSSIBILITY OF SUCH DAMAGES.
1715 17. Interpretation of Sections 15 and 16.
1717 If the disclaimer of warranty and limitation of liability provided
1718 above cannot be given local legal effect according to their terms,
1719 reviewing courts shall apply local law that most closely
1720 approximates an absolute waiver of all civil liability in
1721 connection with the Program, unless a warranty or assumption of
1722 liability accompanies a copy of the Program in return for a fee.
1724 END OF TERMS AND CONDITIONS
1726 How to Apply These Terms to Your New Programs
1727 =============================================
1729 If you develop a new program, and you want it to be of the greatest
1730 possible use to the public, the best way to achieve this is to make it
1731 free software which everyone can redistribute and change under these
1734 To do so, attach the following notices to the program. It is safest
1735 to attach them to the start of each source file to most effectively
1736 state the exclusion of warranty; and each file should have at least the
1737 "copyright" line and a pointer to where the full notice is found.
1739 ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES.
1740 Copyright (C) YEAR NAME OF AUTHOR
1742 This program is free software: you can redistribute it and/or modify
1743 it under the terms of the GNU General Public License as published by
1744 the Free Software Foundation, either version 3 of the License, or (at
1745 your option) any later version.
1747 This program is distributed in the hope that it will be useful, but
1748 WITHOUT ANY WARRANTY; without even the implied warranty of
1749 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1750 General Public License for more details.
1752 You should have received a copy of the GNU General Public License
1753 along with this program. If not, see <http://www.gnu.org/licenses/>.
1755 Also add information on how to contact you by electronic and paper mail.
1757 If the program does terminal interaction, make it output a short notice
1758 like this when it starts in an interactive mode:
1760 PROGRAM Copyright (C) YEAR NAME OF AUTHOR
1761 This program comes with ABSOLUTELY NO WARRANTY; for details
1762 type 'show w'. This is free software, and you are
1763 welcome to redistribute it under certain conditions;
1764 type 'show c' for details.
1766 The hypothetical commands 'show w' and 'show c' should show the
1767 appropriate parts of the General Public License. Of course, your
1768 program's commands might be different; for a GUI interface, you would
1771 You should also get your employer (if you work as a programmer) or
1772 school, if any, to sign a "copyright disclaimer" for the program, if
1773 necessary. For more information on this, and how to apply and follow
1774 the GNU GPL, see <http://www.gnu.org/licenses/>.
1776 The GNU General Public License does not permit incorporating your
1777 program into proprietary programs. If your program is a subroutine
1778 library, you may consider it more useful to permit linking proprietary
1779 applications with the library. If this is what you want to do, use the
1780 GNU Lesser General Public License instead of this License. But first,
1781 please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.
1784 File: ksba.info, Node: Concept Index, Next: Function and Data Index, Prev: Copying, Up: Top
1790 File: ksba.info, Node: Function and Data Index, Prev: Concept Index, Up: Top
1792 Function and Data Index
1793 ***********************
1798 * ksba_cert_get_authority_info_access: Retrieving attributes.
1800 * ksba_cert_get_auth_key_id: Retrieving attributes.
1802 * ksba_cert_get_cert_policies: Retrieving attributes.
1804 * ksba_cert_get_crl_dist_point: Retrieving attributes.
1806 * ksba_cert_get_digest_algo: Retrieving attributes.
1808 * ksba_cert_get_extension: Retrieving attributes.
1810 * ksba_cert_get_ext_key_usages: Retrieving attributes.
1812 * ksba_cert_get_image: Retrieving attributes.
1814 * ksba_cert_get_issuer: Retrieving attributes.
1816 * ksba_cert_get_key_usage: Retrieving attributes.
1818 * ksba_cert_get_public_key: Retrieving attributes.
1820 * ksba_cert_get_serial: Retrieving attributes.
1822 * ksba_cert_get_sig_val: Retrieving attributes.
1824 * ksba_cert_get_subject: Retrieving attributes.
1826 * ksba_cert_get_subject_info_access: Retrieving attributes.
1828 * ksba_cert_get_subj_key_id: Retrieving attributes.
1830 * ksba_cert_get_user_data: User data. (line 26)
1831 * ksba_cert_get_validity: Retrieving attributes.
1833 * ksba_cert_hash: Retrieving attributes.
1835 * ksba_cert_init_from_mem: Creating certificates.
1837 * ksba_cert_is_ca: Retrieving attributes.
1839 * ksba_cert_new: Creating certificates.
1841 * ksba_cert_read_der: Creating certificates.
1843 * ksba_cert_ref: Creating certificates.
1845 * ksba_cert_release: Creating certificates.
1847 * ksba_cert_set_user_data: User data. (line 11)
1848 * ksba_cert_t: Certificate Handling.
1850 * ksba_check_version: Version Check. (line 12)
1851 * ksba_cms_get_content_oid: CMS Parser. (line 89)
1852 * ksba_cms_get_content_type: CMS Parser. (line 54)
1853 * ksba_cms_new: CMS Basics. (line 16)
1854 * ksba_cms_parse: CMS Parser. (line 13)
1855 * ksba_cms_release: CMS Basics. (line 25)
1856 * ksba_cms_set_reader_writer: CMS Basics. (line 31)
1857 * ksba_cms_t: CMS Basics. (line 10)
1858 * ksba_content_t: CMS Parser. (line 61)
1859 * ksba_dn_teststr: DNs. (line 9)
1860 * ksba_isotime_t: Retrieving attributes.
1862 * ksba_name_enum: Names. (line 17)
1863 * ksba_name_get_uri: Names. (line 36)
1864 * ksba_name_release: Names. (line 13)
1865 * ksba_name_t: Names. (line 10)
1866 * ksba_sexp_t: Certificate Handling.
1868 * ksba_stop_reason_t: CMS Basics. (line 12)
1874 Node: Introduction
\7f2768
1875 Node: Getting Started
\7f3046
1876 Node: Features
\7f3912
1877 Node: Overview
\7f5003
1878 Node: Preparation
\7f5252
1880 Node: Version Check
\7f6331
1881 Node: Building the source
\7f7423
1882 Node: Certificate Handling
\7f9267
1883 Node: Creating certificates
\7f10248
1884 Node: Retrieving attributes
\7f12709
1885 Node: Setting attributes
\7f26927
1886 Node: User data
\7f27192
1888 Node: CMS Basics
\7f29571
1889 Node: CMS Parser
\7f31634
1891 Node: PKCS10
\7f35895
1892 Node: Utilities
\7f36156
1896 Node: Error Handling
\7f40207
1897 Node: Component Labels
\7f41562
1898 Node: Copying
\7f43125
1899 Node: Concept Index
\7f80652
1900 Node: Function and Data Index
\7f80780