2007-10-01 [colin] 3.0.1cvs2-stable
[claws.git] / src / common / ssl_certificate.h
blobda8039e04ab3936bd155490a2df037b514dd451e
1 /*
2 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2007 Colin Leroy <colin@colino.net>
4 * and the Claws Mail team
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef __SSL_CERTIFICATE_H__
22 #define __SSL_CERTIFICATE_H__
24 #ifdef HAVE_CONFIG_H
25 # include "config.h"
26 #endif
28 #if USE_OPENSSL
30 #include <openssl/ssl.h>
31 #include <openssl/objects.h>
32 #include <glib.h>
34 #define SSLCERT_ASK_HOOKLIST "sslcert_ask"
36 typedef struct _SSLCertificate SSLCertificate;
38 struct _SSLCertificate
40 X509 *x509_cert;
41 gchar *host;
42 gushort port;
43 gchar *fingerprint;
46 typedef struct _SSLCertHookData SSLCertHookData;
48 struct _SSLCertHookData
50 SSLCertificate *cert;
51 SSLCertificate *old_cert;
52 gboolean expired;
53 gboolean accept;
56 SSLCertificate *ssl_certificate_find (gchar *host, gushort port, const gchar *fingerprint);
57 SSLCertificate *ssl_certificate_find_lookup (gchar *host, gushort port, const gchar *fingerprint, gboolean lookup);
58 gboolean ssl_certificate_check (X509 *x509_cert, gchar *fqdn, gchar *host, gushort port);
59 char* ssl_certificate_to_string(SSLCertificate *cert);
60 void ssl_certificate_destroy(SSLCertificate *cert);
61 void ssl_certificate_delete_from_disk(SSLCertificate *cert);
62 char * readable_fingerprint(unsigned char *src, int len);
63 char *ssl_certificate_check_signer (X509 *cert);
64 time_t asn1toTime(ASN1_TIME *asn1Time);
66 #endif /* USE_OPENSSL */
67 #endif /* SSL_CERTIFICATE_H */