Loading...
Searching...
No Matches
_PurpleCertificateScheme Struct Reference

A certificate type. More...

`#include <certificate.h>`

## Data Fields

gchar * | name
| Name of the certificate type ex: "x509", "pgp", etc.
gchar * | fullname
| User-friendly name for this type ex: N_("X.509 Certificates") When this is displayed anywhere, it should be i18ned ex: _(scheme->fullname).
PurpleCertificate *(* | import_certificate )(const gchar *filename)
| Imports a certificate from a file.
gboolean(* | export_certificate )(const gchar *filename, PurpleCertificate *crt)
| Exports a certificate to a file.
PurpleCertificate *(* | copy_certificate )(PurpleCertificate *crt)
| Duplicates a certificate.
void(* | destroy_certificate )(PurpleCertificate *crt)
| Destroys and frees a Certificate structure.
gboolean(* | signed_by )(PurpleCertificate *crt, PurpleCertificate *issuer)
| Find whether "crt" has a valid signature from "issuer," including appropriate values for the CA flag in the basic constraints extension.
GByteArray *(* | get_fingerprint_sha1 )(PurpleCertificate *crt)
| Retrieves the certificate public key fingerprint using SHA1.
gchar *(* | get_unique_id )(PurpleCertificate *crt)
| Retrieves a unique certificate identifier.
gchar *(* | get_issuer_unique_id )(PurpleCertificate *crt)
| Retrieves a unique identifier for the certificate's issuer.
gchar *(* | get_subject_name )(PurpleCertificate *crt)
| Gets the certificate subject's name.
gboolean(* | check_subject_name )(PurpleCertificate *crt, const gchar *name)
| Check the subject name against that on the certificate.
gboolean(* | get_times )(PurpleCertificate *crt, time_t *activation, time_t *expiration)
| Retrieve the certificate activation/expiration times.
GSList *(* | import_certificates )(const gchar *filename)
| Imports certificates from a file.
gboolean(* | register_trusted_tls_cert )(PurpleCertificate *crt, gboolean ca)
| Register a certificate as "trusted.".
void(* | verify_cert )(PurpleCertificateVerificationRequest *vrq, PurpleCertificateInvalidityFlags *flags)
| Verify that a certificate is valid, performing all necessary checks including date range, valid cert chain, recognized and valid CAs, etc.
unsigned long | struct_size
| The size of the PurpleCertificateScheme.
GByteArray *(* | get_fingerprint_sha256 )(PurpleCertificate *crt)
| Retrieves the certificate public key fingerprint using SHA256.
gboolean(* | compare_pubkeys )(PurpleCertificate *crt1, PurpleCertificate *crt2)
| Compares the public keys of two certificates.

## Detailed Description

A certificate type.

A CertificateScheme must implement all of the fields in the structure, and register it using purple_certificate_register_scheme()

There may be only ONE CertificateScheme provided for each certificate type, as specified by the "name" field.

Definition at line 190 of file certificate.h.

## Field Documentation

## check_subject_name

gboolean(* _PurpleCertificateScheme::check_subject_name) (PurpleCertificate *crt, const gchar *name)

Check the subject name against that on the certificate.

See also
  purple_certificate_check_subject_name()

Returns
  TRUE if it is a match, else FALSE

Definition at line 294 of file certificate.h.

## compare_pubkeys

gboolean(* _PurpleCertificateScheme::compare_pubkeys) (PurpleCertificate *crt1, PurpleCertificate *crt2)

Compares the public keys of two certificates.

Parameters

  crt1 | A certificate instance
  crt2 | Another certificate instance

Returns
  TRUE if both certificates have the same key, otherwise FALSE

Since
  2.12.0

Definition at line 344 of file certificate.h.

## copy_certificate

PurpleCertificate *(* _PurpleCertificateScheme::copy_certificate) (PurpleCertificate *crt)

Duplicates a certificate.

Certificates are generally assumed to be read-only, so feel free to do any sort of reference-counting magic you want here. If this ever changes, please remember to change the magic accordingly.

Returns
  Reference to the new copy

Definition at line 232 of file certificate.h.

## destroy_certificate

void(* _PurpleCertificateScheme::destroy_certificate) (PurpleCertificate *crt)

Destroys and frees a Certificate structure.

Destroys a Certificate's internal data structures and calls free(crt)

Parameters

  crt | Certificate instance to be destroyed. It WILL NOT be destroyed if it is not of the correct CertificateScheme. Can be NULL

Definition at line 243 of file certificate.h.

## export_certificate

gboolean(* _PurpleCertificateScheme::export_certificate) (const gchar *filename, PurpleCertificate *crt)

Exports a certificate to a file.

Parameters

  filename | File to export the certificate to
  crt | Certificate to export

Returns
  TRUE if the export succeeded, otherwise FALSE

See also
  purple_certificate_export()

Definition at line 222 of file certificate.h.

## fullname

gchar* _PurpleCertificateScheme::fullname

User-friendly name for this type ex: N_("X.509 Certificates") When this is displayed anywhere, it should be i18ned ex: _(scheme->fullname).

Definition at line 204 of file certificate.h.

## get_fingerprint_sha1

GByteArray *(* _PurpleCertificateScheme::get_fingerprint_sha1) (PurpleCertificate *crt)

Retrieves the certificate public key fingerprint using SHA1.

Parameters

  crt | Certificate instance

Returns
  Binary representation of SHA1 hash - must be freed using g_byte_array_free()

Definition at line 256 of file certificate.h.

## get_fingerprint_sha256

GByteArray *(* _PurpleCertificateScheme::get_fingerprint_sha256) (PurpleCertificate *crt)

Retrieves the certificate public key fingerprint using SHA256.

Parameters

  crt | Certificate instance

Returns
  Binary representation of SHA256 hash - must be freed using g_byte_array_free()

Since
  2.12.0

Definition at line 334 of file certificate.h.

## get_issuer_unique_id

gchar *(* _PurpleCertificateScheme::get_issuer_unique_id) (PurpleCertificate *crt)

Retrieves a unique identifier for the certificate's issuer.

Parameters

  crt | Certificate instance

Returns
  Newly allocated string that can be used to uniquely identify the issuer's certificate.

Definition at line 274 of file certificate.h.

## get_subject_name

gchar *(* _PurpleCertificateScheme::get_subject_name) (PurpleCertificate *crt)

Gets the certificate subject's name.

For X.509, this is the "Common Name" field, as we're only using it for hostname verification at the moment

See also
  purple_certificate_get_subject_name()

Parameters

  crt | Certificate instance

Returns
  Newly allocated string with the certificate subject.

Definition at line 287 of file certificate.h.

## get_times

gboolean(* _PurpleCertificateScheme::get_times) (PurpleCertificate *crt, time_t *activation, time_t *expiration)

Retrieve the certificate activation/expiration times.

Definition at line 297 of file certificate.h.

## get_unique_id

gchar *(* _PurpleCertificateScheme::get_unique_id) (PurpleCertificate *crt)

Retrieves a unique certificate identifier.

Parameters

  crt | Certificate instance

Returns
  Newly allocated string that can be used to uniquely identify the certificate.

Definition at line 265 of file certificate.h.

## import_certificate

PurpleCertificate *(* _PurpleCertificateScheme::import_certificate) (const gchar *filename)

Imports a certificate from a file.

Parameters

  filename | File to import the certificate from

Returns
  Pointer to the newly allocated Certificate struct or NULL on failure.

Definition at line 212 of file certificate.h.

## import_certificates

GSList *(* _PurpleCertificateScheme::import_certificates) (const gchar *filename)

Imports certificates from a file.

Parameters

  filename | File to import the certificates from

Returns
  GSList of pointers to the newly allocated Certificate structs or NULL on failure.

Definition at line 305 of file certificate.h.

## name

gchar* _PurpleCertificateScheme::name

Name of the certificate type ex: "x509", "pgp", etc.

This must be globally unique - you may not register more than one CertificateScheme of the same name at a time.

Definition at line 197 of file certificate.h.

## register_trusted_tls_cert

gboolean(* _PurpleCertificateScheme::register_trusted_tls_cert) (PurpleCertificate *crt, gboolean ca)

Register a certificate as "trusted.".

Definition at line 310 of file certificate.h.

## signed_by

gboolean(* _PurpleCertificateScheme::signed_by) (PurpleCertificate *crt, PurpleCertificate *issuer)

Find whether "crt" has a valid signature from "issuer," including appropriate values for the CA flag in the basic constraints extension.

See also
  purple_certificate_signed_by()

Definition at line 248 of file certificate.h.

## struct_size

unsigned long _PurpleCertificateScheme::struct_size

The size of the PurpleCertificateScheme.

This should always be sizeof(PurpleCertificateScheme). This allows adding more functions to this struct without requiring a major version bump.

PURPLE_CERTIFICATE_SCHEME_HAS_FUNC() should be used for functions after this point.

Definition at line 324 of file certificate.h.

## verify_cert

void(* _PurpleCertificateScheme::verify_cert) (PurpleCertificateVerificationRequest *vrq, PurpleCertificateInvalidityFlags *flags)

Verify that a certificate is valid, performing all necessary checks including date range, valid cert chain, recognized and valid CAs, etc.

Definition at line 316 of file certificate.h.

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

- certificate.h