OpenVAS Libraries  4.0+rc3.SVN
Data Structures | Functions
base/certificate.h File Reference

Certificate header file. More...

#include <glib.h>

Go to the source code of this file.

Data Structures

struct  certificate_t
 Information about a certificate. More...
struct  certificates_t
 A collection of certificates. More...

Functions

certificate_tcertificate_create (void)
 Create a new, empty certificate structure.
certificate_tcertificate_create_full (const char *fingerprint, const char *owner, const char *public_key, gboolean trusted)
 Create a new certificate structure wih all values set.
void certificate_free (certificate_t *)
 Free memory of a certificate structure.
const gchar * certificate_fingerprint (const certificate_t *)
 Get the fingerprint of a certificate.
const gchar * certificate_owner (const certificate_t *)
 Get the owner of a certificate.
const gchar * certificate_public_key (const certificate_t *)
 Get the public key of a certificate.
gboolean certificate_trusted (const certificate_t *)
 Get the trustedness of a certificate.
const gchar * certificate_trust_level (const certificate_t *)
int certificate_set_fingerprint (certificate_t *, const gchar *)
 Set the fingerprint of a certificate.
int certificate_set_owner (certificate_t *, const gchar *)
 Set the owner of a certificate.
int certificate_set_public_key (certificate_t *, const gchar *)
 Set the public key of a certificate.
void certificate_set_trusted (certificate_t *, gboolean)
 Set the trustedness of a certificate.
certificates_tcertificates_create ()
 Make a collection of certificates.
void certificates_free (certificates_t *)
 Free a collection of certificates.
guint certificates_size (certificates_t *)
 Get the size of a collection of certificates.
void certificates_add (certificates_t *, certificate_t *)
 Add a certificate to a collection of certificate.
certificate_tcertificates_find (certificates_t *certificates, gconstpointer data, GCompareFunc function)
 Search the certificates with a function.

Detailed Description

Certificate header file.


Function Documentation

Create a new, empty certificate structure.

Todo:
Correct doc or implementation for the set_* methods, they always return 0.
Returns:
NULL in case the memory could not be allocated. Else an empty certificate structure which needs to be released using certificate_free .
certificate_t* certificate_create_full ( const char *  fingerprint,
const char *  owner,
const char *  public_key,
gboolean  trusted 
)

Create a new certificate structure wih all values set.

Parameters:
fingerprintFingerprint of the certificate.
ownerName of the owner of the certificate.
public_keyFull public key of the certificate.
trustedWhether or not this certificate is trustworthy.
Returns:
NULL in case the memory could not be allocated. Else a filled certificate structure which owns its values and needs to be released using certificate_free .
const gchar* certificate_fingerprint ( const certificate_t certificate)

Get the fingerprint of a certificate.

Parameters:
certificateThe certificate.
Returns:
The fingerprint, which may be NULL.
void certificate_free ( certificate_t certificate)

Free memory of a certificate structure.

Parameters:
nThe structure to be freed.
const gchar* certificate_owner ( const certificate_t certificate)

Get the owner of a certificate.

Parameters:
certificateThe certificate.
Returns:
The owner, which may be NULL.
const gchar* certificate_public_key ( const certificate_t certificate)

Get the public key of a certificate.

Parameters:
certificateThe certificate.
Returns:
The public key, which may be NULL.
int certificate_set_fingerprint ( certificate_t certificate,
const gchar *  fingerprint 
)

Set the fingerprint of a certificate.

Parameters:
certificateThe certificate.
fingerprintThe fingerprint.
Returns:
0 on success, -1 on error.
int certificate_set_owner ( certificate_t certificate,
const gchar *  owner 
)

Set the owner of a certificate.

Parameters:
certificateThe certificate.
ownerThe owner.
Returns:
0 on success, -1 on error.
int certificate_set_public_key ( certificate_t certificate,
const gchar *  public_key 
)

Set the public key of a certificate.

Parameters:
certificateThe certificate.
publickey The public key.
Returns:
0 on success, -1 on error.
void certificate_set_trusted ( certificate_t certificate,
gboolean  trusted 
)

Set the trustedness of a certificate.

Parameters:
certificateThe certificate.
trustedTRUE if trusted, else FALSE.
gboolean certificate_trusted ( const certificate_t certificate)

Get the trustedness of a certificate.

Parameters:
certificateThe certificate.
Returns:
TRUE if the key is trusted, else FALSE.
void certificates_add ( certificates_t certificates,
certificate_t certificate 
)

Add a certificate to a collection of certificate.

Parameters:
certificatesThe collection of certificates.

Make a collection of certificates.

Returns:
A new collection of certificates or NULL on error.
certificate_t* certificates_find ( certificates_t certificates,
gconstpointer  data,
GCompareFunc  function 
)

Search the certificates with a function.

Parameters:
certificatesCertificates to search.
dataFirst argument to function.
functionComparison function.
Returns:
The first element for which the comparison function function returns 0.
void certificates_free ( certificates_t certificates)

Free a collection of certificates.

Parameters:
certificatesThe collection of certificates.
guint certificates_size ( certificates_t certificates)

Get the size of a collection of certificates.

Returns:
The number of entries in the collection.