# QCA::CertificateChain Class Reference
[QCA user API]

A chain of related Certificates. More...

`#include <QtCrypto>`

Inheritance diagram for QCA::CertificateChain:

Collaboration diagram for QCA::CertificateChain:

[legend]

List of all members.

## Public Member Functions

| CertificateChain (const Certificate &primary)
| CertificateChain ()
CertificateChain | complete (const QList< Certificate > &issuers=QList< Certificate >(), Validity *result=0) const
const Certificate & | primary () const
Validity | validate (const CertificateCollection &trusted, const QList< CRL > &untrusted_crls=QList< CRL >(), UsageMode u=UsageAny, ValidateFlags vf=ValidateAll) const

## Detailed Description

A chain of related Certificates.

CertificateChain is a list (a QList) of certificates that are related by the signature from one to another. If Certificate C signs Certificate B, and Certificate B signs Certificate A, then C, B and A form a chain.

The normal use of a CertificateChain is from a end-user Certificate (called the primary, equivalent to QList::first()) through some intermediate Certificates to some other Certificate (QList::last()), which might be a root Certificate Authority, but does not need to be.

You can build up the chain using normal QList operations, such as QList::append().

See also:
  QCA::CertificateCollection for an alternative way to represent a group of Certificates that do not necessarily have a chained relationship.

Examples:

  publickeyexample.cpp.

## Constructor & Destructor Documentation

QCA::CertificateChain::CertificateChain | ( |  | ) | `[inline]`

Create an empty certificate chain.

Referenced by complete().

QCA::CertificateChain::CertificateChain | ( | const Certificate & | primary | ) | `[inline]`

Create a certificate chain, starting at the specified certificate.

Parameters:

  | primary | the end-user certificate that forms one end of the chain

References QList::append().

## Member Function Documentation

CertificateChain QCA::CertificateChain::complete | ( | const QList< Certificate > & | issuers = `QList<Certificate>()`,
|  | Validity * | result = `0` |
| ) |  |  | const`[inline]`

Complete a certificate chain for the primary certificate, using the rest of the certificates in the chain object, as well as those in issuers, as possible issuers in the chain.

If there are issuers missing, then the chain might be incomplete (at the worst case, if no issuers exist for the primary certificate, then the resulting chain will consist of just the primary certificate). Use the result argument to find out if there was a problem during completion. A result of ValidityGood means the chain was completed successfully.

The newly constructed CertificateChain is returned.

If the certificate chain is empty, then this will return an empty CertificateChain object.

Parameters:

  | issuers | a pool of issuers to draw from as necessary
  | result | the result of the completion operation

Note:
  This function may block

See also:
  validate

References CertificateChain(), QList::first(), and QList::isEmpty().

const Certificate& QCA::CertificateChain::primary | ( |  | ) | const`[inline]`

Return the primary (end-user) Certificate.

References QList::first().

Validity QCA::CertificateChain::validate | ( | const CertificateCollection & | trusted,
|  | const QList< CRL > & | untrusted_crls = `QList<CRL>()`,
|  | UsageMode | u = `UsageAny`,
|  | ValidateFlags | vf = `ValidateAll` |
| ) |  |  | const`[inline]`

Check the validity of a certificate chain.

Parameters:

  | trusted | a collection of trusted certificates
  | untrusted_crls | a list of additional CRLs, not necessarily trusted
  | u | the use required for the primary certificate
  | vf | the conditions to validate

Note:
  This function may block

See also:
  Certificate::validate()

References QCA::ErrorValidityUnknown, QList::first(), and QList::isEmpty().

The documentation for this class was generated from the following file:

- qca_cert.h