1 | /* abac_openssl.h */ |
---|
2 | |
---|
3 | #ifndef __ABAC_OPENSSL_H__ |
---|
4 | #define __ABAC_OPENSSL_H__ |
---|
5 | |
---|
6 | #include <stdio.h> |
---|
7 | #include <openssl/x509.h> |
---|
8 | #include <openssl/err.h> |
---|
9 | |
---|
10 | /* ID */ |
---|
11 | EVP_PKEY* abac_generate_key(); |
---|
12 | X509 *abac_generate_cert(EVP_PKEY *, char*, long); |
---|
13 | |
---|
14 | // 8 bytes |
---|
15 | unsigned char *abac_generate_serial(); |
---|
16 | |
---|
17 | // |
---|
18 | int init_openssl(); |
---|
19 | int deinit_openssl(); |
---|
20 | |
---|
21 | X509 *abac_load_id_from_fp(FILE *); |
---|
22 | EVP_PKEY *abac_load_privkey_from_fp(FILE *); |
---|
23 | EVP_PKEY *abac_load_privkey_from_chunk(unsigned char *, int); |
---|
24 | X509 *abac_load_id_from_chunk(unsigned char *, int); |
---|
25 | int abac_write_id_to_fp(X509 *cert, FILE *fp); |
---|
26 | int abac_write_privkey_to_fp(EVP_PKEY *key, FILE *fp); |
---|
27 | |
---|
28 | EVP_PKEY *extract_pubkey_from_cert(X509 *); |
---|
29 | |
---|
30 | unsigned char *abac_string_cert(X509 *); |
---|
31 | EVP_PKEY *extract_pubkey_from_cert(X509 *); |
---|
32 | unsigned char *abac_string_privkey(EVP_PKEY *); |
---|
33 | |
---|
34 | char *abac_get_serial(X509 *); |
---|
35 | char *abac_get_cn(X509 *); |
---|
36 | char *abac_get_subject(X509 *); |
---|
37 | char *abac_get_issuer(X509 *); |
---|
38 | |
---|
39 | // sha of cert |
---|
40 | char *abac_get_keyid(X509 *); |
---|
41 | |
---|
42 | int abac_check_validity(X509 *, struct tm *, struct tm *); |
---|
43 | int abac_still_valid(X509 *); |
---|
44 | |
---|
45 | #endif /*__ABAC_OPENSSL_H__ */ |
---|