buildtools/wafsamba: Ensure default python picked up is python3
[Samba.git] / lib / mscat / mscat.h
blobfbf60ffb1176f0f55d53f4a3a69fca26d19cef15
1 /*
2 * Copyright (c) 2016 Andreas Schneider <asn@samba.org>
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef _MSCAT_H
19 #define _MSCAT_H
21 #include <stdbool.h>
22 #include <talloc.h>
23 #include <gnutls/pkcs7.h>
24 #include <libtasn1.h>
26 enum mscat_mac_algorithm {
27 MSCAT_MAC_UNKNOWN,
28 MSCAT_MAC_NULL,
29 MSCAT_MAC_MD5,
30 MSCAT_MAC_SHA1,
31 MSCAT_MAC_SHA256,
32 MSCAT_MAC_SHA512
35 struct mscat_pkcs7;
37 struct mscat_pkcs7 *mscat_pkcs7_init(TALLOC_CTX *mem_ctx);
39 int mscat_pkcs7_import_catfile(struct mscat_pkcs7 *mp7,
40 const char *catfile);
42 int mscat_pkcs7_verify(struct mscat_pkcs7 *mp7,
43 const char *ca_file);
45 struct mscat_ctl;
47 struct mscat_ctl *mscat_ctl_init(TALLOC_CTX *mem_ctx);
49 int mscat_ctl_import(struct mscat_ctl *ctl,
50 struct mscat_pkcs7 *pkcs7);
52 int mscat_ctl_get_member_count(struct mscat_ctl *ctl);
54 enum mscat_checksum_type {
55 MSCAT_CHECKSUM_STRING = 1,
56 MSCAT_CHECKSUM_BLOB
59 struct mscat_ctl_member {
60 struct {
61 enum mscat_checksum_type type;
62 union {
63 const char *string;
64 uint8_t *blob;
66 size_t size;
67 } checksum;
68 struct {
69 const char *name;
70 uint32_t flags;
71 } file;
72 struct {
73 const char *value;
74 uint32_t flags;
75 } osattr;
76 struct {
77 const char *guid;
78 uint32_t id;
79 } info;
80 struct {
81 enum mscat_mac_algorithm type;
82 uint8_t *digest;
83 size_t digest_size;
84 } mac;
87 int mscat_ctl_get_member(struct mscat_ctl *ctl,
88 TALLOC_CTX *mem_ctx,
89 unsigned int idx,
90 struct mscat_ctl_member **member);
92 int mscat_ctl_get_attribute_count(struct mscat_ctl *ctl);
94 struct mscat_ctl_attribute {
95 const char *name;
96 uint32_t flags;
97 const char *value;
100 int mscat_ctl_get_attribute(struct mscat_ctl *ctl,
101 TALLOC_CTX *mem_ctx,
102 unsigned int idx,
103 struct mscat_ctl_attribute **pattribute);
105 #endif /* _MSCAT_H */