| 1 |
#ifndef _CANL_OCSP_H |
| 2 |
#define _CANL_OCSP_H |
| 3 |
#include "canl_locl.h" |
| 4 |
|
| 5 |
typedef struct { |
| 6 |
char *ca_dir; |
| 7 |
char *ca_file; |
| 8 |
char *crl_dir; |
| 9 |
} canl_x509store_t; |
| 10 |
|
| 11 |
typedef struct { |
| 12 |
char *url; |
| 13 |
X509 *cert; |
| 14 |
X509 *issuer; |
| 15 |
STACK_OF(X509) *cert_chain; |
| 16 |
canl_x509store_t store; |
| 17 |
X509 *sign_cert; |
| 18 |
EVP_PKEY *sign_key; |
| 19 |
long skew; |
| 20 |
long maxage; |
| 21 |
int timeout; |
| 22 |
} canl_ocsprequest_t; |
| 23 |
|
| 24 |
typedef enum { |
| 25 |
CANL_OCSPRESULT_ERROR_NOSTATUS = -17, |
| 26 |
CANL_OCSPRESULT_ERROR_INVTIME = -16, |
| 27 |
CANL_OCSPRESULT_ERROR_VERIFYRESPONSE = -15, |
| 28 |
CANL_OCSPRESULT_ERROR_NOTCONFIGURED = -14, |
| 29 |
CANL_OCSPRESULT_ERROR_NOAIAOCSPURI = -13, |
| 30 |
CANL_OCSPRESULT_ERROR_INVALIDRESPONSE = -12, |
| 31 |
CANL_OCSPRESULT_ERROR_CONNECTFAILURE = -11, |
| 32 |
CANL_OCSPRESULT_ERROR_SIGNFAILURE = -10, |
| 33 |
CANL_OCSPRESULT_ERROR_BADOCSPADDRESS = -9, |
| 34 |
CANL_OCSPRESULT_ERROR_OUTOFMEMORY = -8, |
| 35 |
CANL_OCSPRESULT_ERROR_UNKNOWN = -7, |
| 36 |
CANL_OCSPRESULT_ERROR_UNAUTHORIZED = -6, |
| 37 |
CANL_OCSPRESULT_ERROR_SIGREQUIRED = -5, |
| 38 |
CANL_OCSPRESULT_ERROR_TRYLATER = -3, |
| 39 |
CANL_OCSPRESULT_ERROR_INTERNALERROR = -2, |
| 40 |
CANL_OCSPRESULT_ERROR_MALFORMEDREQUEST = -1, |
| 41 |
CANL_OCSPRESULT_CERTIFICATE_VALID = 0, |
| 42 |
CANL_OCSPRESULT_CERTIFICATE_REVOKED = 1 |
| 43 |
} canl_ocspresult_t; |
| 44 |
|
| 45 |
/* Methods to access canl_ocsprequest_t */ |
| 46 |
int set_ocsp_sign_cert(canl_ocsprequest_t *ocspreq, X509 *sign_cert); |
| 47 |
int set_ocsp_sign_key(canl_ocsprequest_t *ocspreq, EVP_PKEY *sign_key); |
| 48 |
int set_ocsp_url(canl_ocsprequest_t *ocspreq, char *url); |
| 49 |
|
| 50 |
int ocsprequest_init(canl_ocsprequest_t **ocspreq); |
| 51 |
void ocsprequest_free(canl_ocsprequest_t *ocspreq); |
| 52 |
|
| 53 |
int do_ocsp_verify (canl_ocsprequest_t *data); |
| 54 |
|
| 55 |
#endif |