1 | /*************************************** 2 | $Revision: 1.14 $ 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 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 | }; 87 | 88 | struct RemoveKeyObject { 89 | char iFilename[FILENAME_LENGTH]; 90 | char keyRing[FILENAME_LENGTH]; 91 | int rc; 92 | u32 keyID; 93 | }; 94 | 95 | enum { 96 | iKO_OK = 0, 97 | iKO_UNCHANGED, 98 | iKO_NOUSERID, 99 | iKO_GENERAL, 100 | iKO_NOTVALIDUSERID, 101 | iKO_NOPUBLICKEY, 102 | iKO_NODEFAULTPUBLICKEYRING, 103 | iKO_CRC_ERROR, 104 | iKO_NO_OPENPGP_DATA, 105 | iKO_NO_IN_FILES, 106 | iKO_SECRET_KEY_PRESENT, 107 | iKO_GENERALFAILURE 108 | }; 109 | 110 | enum { 111 | vSO_IS_VALID = 0, 112 | vSO_KO, 113 | vSO_CRC_ERROR, 114 | vSO_NO_PUBLIC_KEY, 115 | vSO_NO_OPENPGP_DATA, 116 | vSO_NO_IN_FILES, 117 | vSO_NO_OUT_FILES 118 | }; 119 | 120 | enum { 121 | vSO_Type_PlainText = 0, 122 | vSO_Type_Unparsed, 123 | vSO_Type_ToBeGPGVerified, 124 | vSO_Type_Signed 125 | }; 126 | 127 | #ifdef __cplusplus 128 | extern "C" { 129 | #endif 130 | 131 | void PA_VerifySignature(struct VerifySignObject *vSO); 132 | void PA_ImportKey(struct ImportKeyObject *iKO); 133 | void PA_RemoveKey(struct ImportKeyObject *iKO); 134 | void PA_Decrypt(struct ReadCryptedObject *rDO); 135 | EPNodePtr PA_ParseMessage(EPNodePtr ptr); 136 | 137 | #ifdef __cplusplus 138 | } 139 | #endif 140 | 141 | #endif