forked from tmbx/tagcrypt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtagcryptotut.h
67 lines (48 loc) · 1.68 KB
/
tagcryptotut.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* tagcrypt/tagcryptotut.c
* Copyright (C) 2005-2012 Opersys inc., All rights reserved.
*
* Tagcrypt OTUT management function.
*
* @author François-Denis Gonthier
*/
#ifndef _TAGCRYPTOTUT_H
#define _TAGCRYPTOTUT_H
#include <tagcryptsignature.h>
#include <kbuffer.h>
/** parameter passed to add an OTUT subpacket. */
struct tagcrypt_otut {
struct timeval tv;
kbuffer *addr;
kbuffer *data;
};
struct tagcrypt_ticket {
/** Member ID of the client demanding the ticket. */
uint64_t mid;
/** Timestamp of the ticket. */
struct timeval tv;
#define TAGCRYPT_MAX_OTUT_ADDR_SIZE 2048
/** */
kbuffer * otut_addr;
/** Number of replies this ticket will be valid for. */
uint32_t reply_count;
};
void tagcrypt_otut_clean(struct tagcrypt_otut *otut);
int tagcrypt_ticket_init(struct tagcrypt_ticket * ticket);
void tagcrypt_ticket_clean(struct tagcrypt_ticket * ticket);
int tagcrypt_otut_init(struct tagcrypt_otut *otut);
int tagcrypt_otut_serialize(struct tagcrypt_otut *otut, kbuffer *out);
int tagcrypt_otut_realize(kbuffer *otut_buf, struct tagcrypt_otut *otut);
int tagcrypt_gen_otut(struct tagcrypt_ticket *ticket, struct tagcrypt_otut *otut);
/** Good for one OTUT.
*
* \param skey the secret key to sign the ticket data.
* \param nbvalid the number of OTUT this ticket will allow.
* \param out the signed ticket as output.
* \return 0 on error, -1 otherwise.
*/
int tagcrypt_gen_ticket(tagcrypt_skey * skey, uint32_t nbvalid, kbuffer * otut_addr,
kbuffer * out);
int tagcrypt_get_ticket(tagcrypt_pkey *pkey, kbuffer *sign_buffer,
struct tagcrypt_ticket *ticket);
#endif // _TAGCRYPTOTUT_H