Debian Codegraph @

src/canl_cred.h

raw
1 #ifndef _CANL_CRED_H
2 #define _CANL_CRED_H
3
4 #include <canl.h>
5
6 #include <openssl/x509.h>
7
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11
12 typedef void *canl_cred;
13
14 typedef enum canl_cert_type {
15 CANL_EEC,
16 CANL_RFC,
17 } canl_cert_type;
18
19 typedef struct _creds {
20 EVP_PKEY *c_key;
21 STACK_OF(X509) *c_cert_chain;
22 X509 *c_cert;
23 long c_lifetime;
24 STACK_OF(X509_EXTENSION) * c_cert_ext;
25 canl_cert_type c_type;
26 X509_REQ *c_req;
27 } creds;
28
29 /* Routines to handle credentials */
30
31 canl_err_code CANL_CALLCONV
32 canl_cred_new(canl_ctx, canl_cred *);
33
34 canl_err_code CANL_CALLCONV
35 canl_cred_free(canl_ctx, canl_cred);
36
37 canl_err_code CANL_CALLCONV
38 canl_ctx_set_cred(canl_ctx, canl_cred);
39
40 canl_err_code CANL_CALLCONV
41 canl_cred_load_priv_key_file(canl_ctx, canl_cred, const char *,
42 canl_password_callback, void *);
43 canl_err_code CANL_CALLCONV
44 canl_cred_load_priv_key(canl_ctx, canl_cred, EVP_PKEY *);
45
46 canl_err_code CANL_CALLCONV
47 canl_cred_save_priv_key(canl_ctx, canl_cred, EVP_PKEY **);
48
49 canl_err_code CANL_CALLCONV
50 canl_cred_load_priv_key_pkcs11(canl_ctx, canl_cred, const char *,
51 canl_password_callback, void *);
52
53 canl_err_code CANL_CALLCONV
54 canl_cred_load_chain(canl_ctx, canl_cred, STACK_OF(X509) *);
55
56 canl_err_code CANL_CALLCONV
57 canl_cred_load_chain_file(canl_ctx, canl_cred, const char *);
58
59 canl_err_code CANL_CALLCONV
60 canl_cred_load_cert(canl_ctx, canl_cred, X509 *);
61
62 canl_err_code CANL_CALLCONV
63 canl_cred_load_cert_file(canl_ctx, canl_cred, const char *);
64
65 canl_err_code CANL_CALLCONV
66 canl_cred_load_cert_pkcs11(canl_ctx, canl_cred, const char *);
67
68 canl_err_code CANL_CALLCONV
69 canl_cred_set_lifetime(canl_ctx, canl_cred, const long);
70
71 canl_err_code CANL_CALLCONV
72 canl_cred_set_extension(canl_ctx, canl_cred, X509_EXTENSION *);
73
74 canl_err_code CANL_CALLCONV
75 canl_cred_set_cert_type(canl_ctx, canl_cred, const enum canl_cert_type);
76
77 canl_err_code CANL_CALLCONV
78 canl_cred_sign_proxy(canl_ctx, canl_cred, canl_cred);
79
80 canl_err_code CANL_CALLCONV
81 canl_cred_save_proxyfile(canl_ctx, canl_cred, const char *);
82
83 canl_err_code CANL_CALLCONV
84 canl_cred_save_cert(canl_ctx, canl_cred, X509 **);
85
86 canl_err_code CANL_CALLCONV
87 canl_cred_save_chain(canl_ctx, canl_cred, STACK_OF(X509) **);
88
89 /* Routines to handle X.509 requests */
90
91 canl_err_code CANL_CALLCONV
92 canl_cred_new_req(canl_ctx, canl_cred, unsigned int);
93
94 canl_err_code CANL_CALLCONV
95 canl_cred_save_req(canl_ctx, canl_cred, X509_REQ **);
96
97 canl_err_code CANL_CALLCONV
98 canl_cred_load_req(canl_ctx, canl_cred, const X509_REQ *);
99
100 /* Routines to verify cert. chain */
101
102 /* Verify certificate chain, openssl verif. CRL, OCSP, signing policies etc.
103 */
104 canl_err_code CANL_CALLCONV
105 canl_verify_chain(canl_ctx ctx, X509 *ucert, STACK_OF(X509) *cert_chain,
106 char *cadir);
107
108 /* Verify certificate chain, SKIP openssl verif. part; Check CRL, OCSP,
109 * signing policies etc. */
110 canl_err_code CANL_CALLCONV
111 canl_verify_chain_wo_ossl(canl_ctx ctx, char *cadir,
112 X509_STORE_CTX *store_ctx);
113
114 #if 0
115 canl_err_code CANL_CALLCONV
116 canl_req_get_pair(canl_ctx, canl_x509_req, EVP_PKEY **);
117 #endif
118
119 #ifdef __cplusplus
120 }
121 #endif
122
123 #endif