ekg2  GIT master
simlite.h
Idź do dokumentacji tego pliku.
1 /* $Id$ */
2 
3 /*
4  * (C) Copyright 2003 Wojtek Kaniewski <wojtekka@irc.pl>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License Version
8  * 2.1 as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 
20 #ifndef __SIMLITE_H
21 #define __SIMLITE_H
22 
23 extern char *sim_key_path;
24 extern int sim_errno;
25 
26 typedef enum {
27  SIM_ERROR_SUCCESS, /* udało się */
28  SIM_ERROR_PUBLIC, /* błąd klucza publicznego */
29  SIM_ERROR_PRIVATE, /* błąd klucza prywatnego */
30  SIM_ERROR_RSA, /* nie udało się odszyfrować RSA */
31  SIM_ERROR_BF, /* nie udało się odszyfrować BF */
32  SIM_ERROR_RAND, /* entropia poszła na piwo */
33  SIM_ERROR_MEMORY, /* brak pamięci */
34  SIM_ERROR_INVALID, /* niewłaściwa wiadomość (za krótka) */
35  SIM_ERROR_MAGIC /* niewłaściwy magic */
36 } sim_errno_t;
37 
38 #define SIM_MAGIC_V1 0x2391
39 #define SIM_MAGIC_V1_BE 0x9123
40 
41 typedef struct {
42  unsigned char init[8];
43  guint16 magic;
44  guint8 flags;
45 }
46 #ifdef __GNUC__
47 __attribute__ ((packed))
48 #endif
50 
51 char *sim_message_decrypt(const unsigned char *message, const char *uid);
52 char *sim_message_encrypt(const unsigned char *message, const char *uid);
53 int sim_key_generate(const char *uid);
54 char *sim_key_fingerprint(const char *uid);
55 
56 const char *sim_strerror(int error);
57 
58 #endif /* __SIMLITE_H */
59 
60 /*
61  * Local Variables:
62  * mode: c
63  * c-file-style: "k&r"
64  * c-basic-offset: 8
65  * indent-tabs-mode: t
66  * End:
67  */
struct _gim_host __attribute__
Definition: commands.c:66
char * sim_key_fingerprint(const char *uid)
Definition: simlite.c:183
Definition: simlite.h:41
Definition: simlite.h:29
sim_errno_t
Definition: simlite.h:26
Definition: simlite.h:33
char * sim_message_encrypt(const unsigned char *message, const char *uid)
Definition: simlite.c:291
int sim_key_generate(const char *uid)
Definition: simlite.c:77
char * sim_message_decrypt(const unsigned char *message, const char *uid)
Definition: simlite.c:393
Definition: simlite.h:27
Definition: simlite.h:28
const char * sim_strerror(int error)
Definition: simlite.c:243
Definition: simlite.h:32
Definition: simlite.h:30
guint8 flags
Definition: simlite.h:44
Definition: simlite.h:35
guint16 magic
Definition: simlite.h:43
int sim_errno
Definition: simlite.c:44
Definition: simlite.h:31
Definition: simlite.h:34
char * sim_key_path
Definition: simlite.c:43