clamav/libclamav/crtmgr.h

68 lines
1.9 KiB
C
Raw Normal View History

2011-12-29 19:39:19 +01:00
/*
* Copyright (C) 2011 Sourcefire, Inc.
*
* Authors: aCaB
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
2011-12-21 19:52:34 +01:00
#ifndef __CRTMGR_H
#define __CRTMGR_H
#include <time.h>
#include "bignum.h"
#include "sha1.h"
typedef enum { CLI_SHA1RSA, CLI_MD5RSA } cli_crt_hashtype;
2012-01-06 20:06:29 +01:00
typedef enum {VRFY_CODE, VRFY_TIME} cli_vrfy_type;
2011-12-21 19:52:34 +01:00
2011-12-21 22:52:46 +01:00
typedef struct cli_crt_t {
2011-12-21 19:52:34 +01:00
uint8_t subject[SHA1_HASH_SIZE];
uint8_t issuer[SHA1_HASH_SIZE];
2011-12-22 20:57:43 +01:00
uint8_t tbshash[SHA1_HASH_SIZE];
2011-12-21 19:52:34 +01:00
mp_int n;
mp_int e;
mp_int sig;
time_t not_before;
time_t not_after;
cli_crt_hashtype hashtype;
2012-01-05 19:20:34 +01:00
int certSign;
int codeSign;
int timeSign;
2011-12-21 22:52:46 +01:00
struct cli_crt_t *prev;
struct cli_crt_t *next;
2011-12-21 19:52:34 +01:00
} cli_crt;
2011-12-21 22:52:46 +01:00
typedef struct {
cli_crt *crts;
2011-12-25 03:49:38 +01:00
unsigned int items;
2011-12-21 22:52:46 +01:00
} crtmgr;
2011-12-21 19:52:34 +01:00
int cli_crt_init(cli_crt *x509);
void cli_crt_clear(cli_crt *x509);
2011-12-25 03:49:38 +01:00
void crtmgr_init(crtmgr *m);
2011-12-30 16:07:53 +01:00
void crtmgr_free(crtmgr *m);
2011-12-21 22:52:46 +01:00
int crtmgr_add(crtmgr *m, cli_crt *x509);
2011-12-22 22:36:47 +01:00
cli_crt *crtmgr_lookup(crtmgr *m, cli_crt *x509);
2011-12-25 03:49:38 +01:00
void crtmgr_del(crtmgr *m, cli_crt *x509);
2011-12-27 19:26:26 +01:00
int crtmgr_verify_crt(crtmgr *m, cli_crt *x509);
2012-01-06 20:06:29 +01:00
int crtmgr_verify_pkcs7(crtmgr *m, const uint8_t *issuer, const void *signature, unsigned int signature_len, cli_crt_hashtype hashtype, const uint8_t *refhash, cli_vrfy_type vrfytype);
2011-12-22 20:57:43 +01:00
int crtmgr_add_roots(crtmgr *m);
2011-12-21 22:52:46 +01:00
2011-12-27 19:26:26 +01:00
2011-12-21 19:52:34 +01:00
#endif