31#ifndef _PURPLE_CERTIFICATE_H
32#define _PURPLE_CERTIFICATE_H
45 PURPLE_CERTIFICATE_INVALID = 0,
46 PURPLE_CERTIFICATE_VALID = 1
47} PurpleCertificateVerificationStatus;
52 PURPLE_CERTIFICATE_UNKNOWN_ERROR = -1,
55 PURPLE_CERTIFICATE_NO_PROBLEMS = 0,
58 PURPLE_CERTIFICATE_NON_FATALS_MASK = 0x0000FFFF,
61 PURPLE_CERTIFICATE_SELF_SIGNED = 0x01,
64 PURPLE_CERTIFICATE_CA_UNKNOWN = 0x02,
69 PURPLE_CERTIFICATE_NOT_ACTIVATED = 0x04,
72 PURPLE_CERTIFICATE_EXPIRED = 0x08,
75 PURPLE_CERTIFICATE_NAME_MISMATCH = 0x10,
78 PURPLE_CERTIFICATE_NO_CA_POOL = 0x20,
81 PURPLE_CERTIFICATE_FATALS_MASK = 0xFFFF0000,
86 PURPLE_CERTIFICATE_INVALID_CHAIN = 0x10000,
89 PURPLE_CERTIFICATE_REVOKED = 0x20000,
91 PURPLE_CERTIFICATE_LAST = 0x40000,
92} PurpleCertificateInvalidityFlags;
106 (PurpleCertificateVerificationStatus st,
174 GList * (* get_idlist)(void);
176 void (*_purple_reserved1)(void);
177 void (*_purple_reserved2)(void);
178 void (*_purple_reserved3)(void);
179 void (*_purple_reserved4)(void);
305 GSList * (* import_certificates)(
const gchar * filename);
347#define PURPLE_CERTIFICATE_SCHEME_HAS_FUNC(obj, member) \
348 (((G_STRUCT_OFFSET(PurpleCertificateScheme, member) < G_STRUCT_OFFSET(PurpleCertificateScheme, struct_size)) \
349 || (G_STRUCT_OFFSET(PurpleCertificateScheme, member) < obj->struct_size)) && \
396 void (*_purple_reserved1)(void);
397 void (*_purple_reserved2)(void);
398 void (*_purple_reserved3)(void);
399 void (*_purple_reserved4)(void);
470 const gchar *subject_name, GList *cert_chain,
483 PurpleCertificateVerificationStatus st);
GSList * purple_certificates_import(PurpleCertificateScheme *scheme, const gchar *filename)
Imports a list of PurpleCertificates from a file.
PurpleCertificatePool * purple_certificate_find_pool(const gchar *scheme_name, const gchar *pool_name)
Look up a registered PurpleCertificatePool by scheme and name.
void purple_certificate_pool_destroy_idlist(GList *idlist)
Destroys the result given by purple_certificate_pool_get_idlist()
gboolean purple_certificate_register_pool(PurpleCertificatePool *pool)
Register a CertificatePool with libpurple and call its init function.
PurpleCertificateScheme * purple_certificate_pool_get_scheme(PurpleCertificatePool *pool)
Looks up the scheme the pool operates under.
gboolean purple_certificate_unregister_scheme(PurpleCertificateScheme *scheme)
Unregister a CertificateScheme from libpurple.
void purple_certificate_init(void)
Initialize the certificate system.
void purple_certificate_destroy_list(GList *crt_list)
Destroy an entire list of Certificate instances and the containing list.
void(* PurpleCertificateVerifiedCallback)(PurpleCertificateVerificationStatus st, gpointer userdata)
Callback function for the results of a verification check.
GList * purple_certificate_copy_list(GList *crt_list)
Duplicates an entire list of certificates.
PurpleCertificateVerifier * purple_certificate_find_verifier(const gchar *scheme_name, const gchar *ver_name)
Look up a registered PurpleCertificateVerifier by scheme and name.
GList * purple_certificate_get_verifiers(void)
Get the list of registered CertificateVerifiers.
gchar * purple_certificate_get_issuer_unique_id(PurpleCertificate *crt)
Get a unique identifier for the certificate's issuer.
gboolean purple_certificate_pool_delete(PurpleCertificatePool *pool, const gchar *id)
Remove a certificate from a pool.
gboolean purple_certificate_pool_contains(PurpleCertificatePool *pool, const gchar *id)
Check for presence of an ID in a pool.
gboolean purple_certificate_check_signature_chain(GList *chain)
Check that a certificate chain is valid.
gboolean purple_certificate_export(const gchar *filename, PurpleCertificate *crt)
Exports a PurpleCertificate to a file.
void purple_certificate_verify(PurpleCertificateVerifier *verifier, const gchar *subject_name, GList *cert_chain, PurpleCertificateVerifiedCallback cb, gpointer cb_data)
Constructs a verification request and passed control to the specified Verifier.
void purple_certificate_verify_complete(PurpleCertificateVerificationRequest *vrq, PurpleCertificateVerificationStatus st)
Completes and destroys a VerificationRequest.
void purple_certificate_add_ca_search_path(const char *path)
Add a search path for certificates.
GByteArray * purple_certificate_get_fingerprint_sha256(PurpleCertificate *crt, gboolean sha1_fallback)
Retrieves the certificate public key fingerprint using SHA256.
gboolean purple_certificate_check_signature_chain_with_failing(GList *chain, PurpleCertificate **failing)
Check that a certificate chain is valid and, if not, the failing certificate.
gboolean purple_certificate_unregister_pool(PurpleCertificatePool *pool)
Unregister a CertificatePool with libpurple and call its uninit function.
PurpleCertificate * purple_certificate_copy(PurpleCertificate *crt)
Makes a duplicate of a certificate.
gboolean purple_certificate_compare_pubkeys(PurpleCertificate *crt1, PurpleCertificate *crt2)
Compares the public keys of two certificates.
gboolean purple_certificate_pool_store(PurpleCertificatePool *pool, const gchar *id, PurpleCertificate *crt)
Add a certificate to a pool.
gpointer purple_certificate_get_handle(void)
Get the Certificate subsystem handle for signalling purposes.
GList * purple_certificate_pool_get_idlist(PurpleCertificatePool *pool)
Get the list of IDs currently in the pool.
PurpleCertificate * purple_certificate_pool_retrieve(PurpleCertificatePool *pool, const gchar *id)
Retrieve a certificate from a pool.
GByteArray * purple_certificate_get_fingerprint_sha1(PurpleCertificate *crt)
Retrieves the certificate public key fingerprint using SHA1.
GList * purple_certificate_get_schemes(void)
Get all registered CertificateSchemes.
gchar * purple_certificate_pool_mkpath(PurpleCertificatePool *pool, const gchar *id)
Helper function for generating file paths in ~/.purple/certificates for CertificatePools that use the...
gboolean purple_certificate_pool_usable(PurpleCertificatePool *pool)
Determines whether a pool can be used.
gboolean purple_certificate_check_subject_name(PurpleCertificate *crt, const gchar *name)
Check the subject name against that on the certificate.
void purple_certificate_display_x509(PurpleCertificate *crt)
Displays a window showing X.509 certificate information.
gboolean purple_certificate_signed_by(PurpleCertificate *crt, PurpleCertificate *issuer)
Check whether 'crt' has a valid signature made by 'issuer'.
gboolean purple_certificate_register_verifier(PurpleCertificateVerifier *vr)
Register a CertificateVerifier with libpurple.
gboolean purple_certificate_get_times(PurpleCertificate *crt, time_t *activation, time_t *expiration)
Get the expiration/activation times.
void purple_certificate_uninit(void)
Un-initialize the certificate system.
gboolean purple_certificate_register_scheme(PurpleCertificateScheme *scheme)
Register a CertificateScheme with libpurple.
gboolean purple_certificate_unregister_verifier(PurpleCertificateVerifier *vr)
Unregister a CertificateVerifier with libpurple.
gchar * purple_certificate_get_unique_id(PurpleCertificate *crt)
Get a unique identifier for the certificate.
gchar * purple_certificate_get_subject_name(PurpleCertificate *crt)
Gets the certificate subject's name.
void purple_certificate_destroy(PurpleCertificate *crt)
Destroys and free()'s a Certificate.
PurpleCertificateScheme * purple_certificate_find_scheme(const gchar *name)
Look up a registered CertificateScheme by name.
GList * purple_certificate_get_pools(void)
Get the list of registered Pools.
PurpleCertificate * purple_certificate_import(PurpleCertificateScheme *scheme, const gchar *filename)
Imports a PurpleCertificate from a file.
Database for retrieval or storage of Certificates.
gboolean(* cert_in_pool)(const gchar *id)
Check for presence of a certificate in the pool using unique ID.
gboolean(* delete_cert)(const gchar *id)
Delete a certificate from the pool.
gchar * name
Internal name to refer to the pool by.
gchar * fullname
User-friendly name for this type ex: N_("SSL Servers") When this is displayed anywhere,...
gchar * scheme_name
Scheme this Pool operates for.
gboolean(* init)(void)
Set up the Pool's internal state.
void(* uninit)(void)
Uninit the Pool's internal state.
gpointer data
Internal pool data.
gboolean(* put_cert)(const gchar *id, PurpleCertificate *crt)
Add a certificate to the pool.
gchar * fullname
User-friendly name for this type ex: N_("X.509 Certificates") When this is displayed anywhere,...
gboolean(* check_subject_name)(PurpleCertificate *crt, const gchar *name)
Check the subject name against that on the certificate.
void(* destroy_certificate)(PurpleCertificate *crt)
Destroys and frees a Certificate structure.
unsigned long struct_size
The size of the PurpleCertificateScheme.
gboolean(* export_certificate)(const gchar *filename, PurpleCertificate *crt)
Exports a certificate to a file.
gboolean(* signed_by)(PurpleCertificate *crt, PurpleCertificate *issuer)
Find whether "crt" has a valid signature from "issuer," including appropriate values for the CA flag ...
void(* verify_cert)(PurpleCertificateVerificationRequest *vrq, PurpleCertificateInvalidityFlags *flags)
Verify that a certificate is valid, performing all necessary checks including date range,...
gboolean(* get_times)(PurpleCertificate *crt, time_t *activation, time_t *expiration)
Retrieve the certificate activation/expiration times.
gboolean(* compare_pubkeys)(PurpleCertificate *crt1, PurpleCertificate *crt2)
Compares the public keys of two certificates.
gchar * name
Name of the certificate type ex: "x509", "pgp", etc.
gboolean(* register_trusted_tls_cert)(PurpleCertificate *crt, gboolean ca)
Register a certificate as "trusted.".
Structure for a single certificate request.
PurpleCertificateVerifier * verifier
Reference to the verification logic used.
gpointer data
Internal data used by the Verifier code.
gpointer cb_data
Data to pass to the post-verification callback.
gchar * subject_name
Name to check that the certificate is issued to.
PurpleCertificateScheme * scheme
Reference to the scheme used.
PurpleCertificateVerifiedCallback cb
Function to call with the verification result.
GList * cert_chain
List of certificates in the chain to be verified (such as that returned by purple_ssl_get_peer_certif...
A set of operations used to provide logic for verifying a Certificate's authenticity.
void(* start_verification)(PurpleCertificateVerificationRequest *vrq)
Start the verification process.
void(* destroy_request)(PurpleCertificateVerificationRequest *vrq)
Destroy a completed Request under this Verifier The function pointed to here is only responsible for ...
gchar * scheme_name
Name of the scheme this Verifier operates on.
gchar * name
Name of the Verifier - case insensitive.
gpointer data
Opaque pointer to internal data.
PurpleCertificateScheme * scheme
Scheme this certificate is under.