OpenVAS Libraries  4.0+rc3.SVN
base/certificate.h
Go to the documentation of this file.
00001 /* openvas-libraries/base
00002  * $Id$
00003  * Description: Certificate header file.
00004  *
00005  * Authors:
00006  * Matthew Mundell <matt@mundell.ukfsn.org>
00007  *
00008  * Copyright:
00009  * Copyright (C) 2009 Greenbone Networks GmbH
00010  *
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License version 2,
00013  * or, at your option, any later version as published by the Free
00014  * Software Foundation
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
00024  */
00025 
00031 #ifndef _CERTIFICATE_H
00032 #define _CERTIFICATE_H
00033 
00034 #include <glib.h>
00035 
00042 typedef struct
00043 {
00044   gchar *fingerprint;           
00045   gchar *owner;                 
00046   gchar *public_key;            
00047   gboolean trusted;             
00048 } certificate_t;
00049 
00050 certificate_t *certificate_create (void);
00051 certificate_t *certificate_create_full (const char *fingerprint,
00052                                         const char *owner,
00053                                         const char *public_key,
00054                                         gboolean trusted);
00055 void certificate_free (certificate_t *);
00056 
00057 const gchar *certificate_fingerprint (const certificate_t *);
00058 const gchar *certificate_owner (const certificate_t *);
00059 const gchar *certificate_public_key (const certificate_t *);
00060 gboolean certificate_trusted (const certificate_t *);
00061 
00062 const gchar *certificate_trust_level (const certificate_t *);
00063 
00064 int certificate_set_fingerprint (certificate_t *, const gchar *);
00065 int certificate_set_owner (certificate_t *, const gchar *);
00066 int certificate_set_public_key (certificate_t *, const gchar *);
00067 void certificate_set_trusted (certificate_t *, gboolean);
00068 
00069 
00070 /* Collections of certificates. */
00071 
00078 typedef struct
00079 {
00080   GSList *list;                 
00081 } certificates_t;
00082 
00083 certificates_t *certificates_create ();
00084 void certificates_free (certificates_t *);
00085 
00086 guint certificates_size (certificates_t *);
00087 
00088 void certificates_add (certificates_t *, certificate_t *);
00089 
00090 certificate_t *certificates_find (certificates_t * certificates,
00091                                   gconstpointer data, GCompareFunc function);
00092 
00093 #endif /* not _CERTIFICATE_H */