modules/pa/gpg.h
/* [<][>][^][v][top][bottom][index][help] */
FUNCTIONS
This source file includes following functions.
1 /***************************************
2 $Revision: 1.18 $
3
4 gpg.h - header for gpg.c .
5
6 Status: COMPLETE, REVUED, TESTED
7
8 ******************/ /******************
9 Filename : gpg.h
10 Authors : filippo@ripe.net
11 OSs Tested : Solaris 7
12 ******************/ /******************
13 Copyright (c) 2000,2001,2002 RIPE NCC
14
15 All Rights Reserved
16
17 Permission to use, copy, modify, and distribute this software and its
18 documentation for any purpose and without fee is hereby granted,
19 provided that the above copyright notice appear in all copies and that
20 both that copyright notice and this permission notice appear in
21 supporting documentation, and that the name of the author not be
22 used in advertising or publicity pertaining to distribution of the
23 software without specific, written prior permission.
24
25 THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
26 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
27 AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
28 DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
29 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
30 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
31 ***************************************/
32
33 #ifndef GPG_H
34 #define GPG_H
35
36 #include <netdb.h>
37 #include <unistd.h>
38 #include "mail_parser.h"
39
40 /* FP: interface file for RIPE gnuPG */
41
42 #define INPUT_FD 0
43 #define OUTPUT_FD 1
44 #define ERROR_FD 2
45
46 #define LINE_LENGTH 1024
47 #define STRING_LENGTH 255
48 #define FILENAME_LENGTH 1024
49
50 #define ERRSTRING strerror (errno)
51
52 #define MAX_LINE_BUF 50000
53
54 /* FP : global objects used as and interface with gnuPG */
55
56 struct VerifySignObject {
57 char iDocSigFilename[FILENAME_LENGTH], /* IN */
58 iSigFilename[FILENAME_LENGTH], /* IN */
59 outputPath[FILENAME_LENGTH], /* IN */
60 oStream[FILENAME_LENGTH]; /* OUT */
61
62 char keyRing[FILENAME_LENGTH];
63 int isValid;
64 u32 keyID;
65 struct VerifySignObject *next;
66 struct VerifySignObject *inner;
67 int nMsg;
68 int type;
69 int isMIME;
70 };
71
72 struct ReadCryptedObject {
73 char iFilename[FILENAME_LENGTH],
74 oStream[FILENAME_LENGTH];
75 char keyRing[FILENAME_LENGTH];
76 int isValid;
77 u32 keyID;
78 };
79
80 struct ImportKeyObject {
81 char iFilename[FILENAME_LENGTH];
82 char keyRing[FILENAME_LENGTH];
83 int rc;
84 u32 keyID;
85 char fingerPrint[STRING_LENGTH];
86 char keyOwner[STRING_LENGTH];
87 };
88
89 struct RemoveKeyObject {
90 char iFilename[FILENAME_LENGTH];
91 char keyRing[FILENAME_LENGTH];
92 int rc;
93 u32 keyID;
94 };
95
96 enum {
97 iKO_OK = 0,
98 iKO_UNCHANGED,
99 iKO_NOUSERID,
100 iKO_GENERAL,
101 iKO_NOTVALIDUSERID,
102 iKO_NOPUBLICKEY,
103 iKO_NODEFAULTPUBLICKEYRING,
104 iKO_CRC_ERROR,
105 iKO_NO_OPENPGP_DATA,
106 iKO_NO_IN_FILES,
107 iKO_SECRET_KEY_PRESENT,
108 iKO_MULTIPLE_KEYS,
109 iKO_GENERALFAILURE
110 };
111
112 enum {
113 vSO_IS_VALID = 0,
114 vSO_KO,
115 vSO_CRC_ERROR,
116 vSO_NO_PUBLIC_KEY,
117 vSO_NO_OPENPGP_DATA,
118 vSO_NO_IN_FILES,
119 vSO_NO_OUT_FILES
120 };
121
122 enum {
123 vSO_Type_PlainText = 0,
124 vSO_Type_Unparsed,
125 vSO_Type_ToBeGPGVerified,
126 vSO_Type_Signed
127 };
128
129 #ifdef __cplusplus
130 extern "C" {
131 #endif
132
133 void PA_VerifySignature(struct VerifySignObject *vSO);
134 void PA_ImportKey(struct ImportKeyObject *iKO);
135 void PA_RemoveKey_withKeyID(struct ImportKeyObject *iKO);
136 void PA_RemoveKey(struct ImportKeyObject *iKO);
137 void PA_Decrypt(struct ReadCryptedObject *rDO);
138 EPNodePtr PA_ParseMessage(EPNodePtr ptr);
139 void GetFingerPrint(struct ImportKeyObject *iKO);
140 void GetKeyOwner(struct ImportKeyObject *iKO);
141
142 #ifdef __cplusplus
143 }
144 #endif
145
146 #endif