1 /*************************************************************************** 2 begin : Wed Jun 22 2011 3 copyright : (C) 2011 by Martin Preuss 4 email : martin@libchipcard.de 5 6 *************************************************************************** 7 * * 8 * This library is free software; you can redistribute it and/or * 9 * modify it under the terms of the GNU Lesser General Public * 10 * License as published by the Free Software Foundation; either * 11 * version 2.1 of the License, or (at your option) any later version. * 12 * * 13 * This library is distributed in the hope that it will be useful, * 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 16 * Lesser General Public License for more details. * 17 * * 18 * You should have received a copy of the GNU Lesser General Public * 19 * License along with this library; if not, write to the Free Software * 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * 21 * MA 02111-1307 USA * 22 * * 23 ***************************************************************************/ 24 25 26 #ifndef GWEN_SAR_H 27 #define GWEN_SAR_H 28 29 30 #include <gwenhywfar/gwen_sar_fileheader.h> 31 #include <gwenhywfar/syncio_file.h> 32 #include <gwenhywfar/cryptmgr.h> 33 #include <gwenhywfar/cryptkey.h> 34 35 36 37 typedef struct GWEN_SAR GWEN_SAR; 38 39 GWENHYWFAR_API 40 GWEN_SAR *GWEN_Sar_new(void); 41 42 GWENHYWFAR_API 43 void GWEN_Sar_Attach(GWEN_SAR *sr); 44 45 GWENHYWFAR_API 46 void GWEN_Sar_free(GWEN_SAR *sr); 47 48 49 50 GWENHYWFAR_API 51 int GWEN_Sar_CreateArchive(GWEN_SAR *sr, const char *aname); 52 53 GWENHYWFAR_API 54 int GWEN_Sar_OpenArchive(GWEN_SAR *sr, const char *aname, 55 GWEN_SYNCIO_FILE_CREATIONMODE cm, 56 uint32_t acc); 57 58 GWENHYWFAR_API 59 int GWEN_Sar_CloseArchive(GWEN_SAR *sr, int abandon); 60 61 62 GWENHYWFAR_API 63 int GWEN_Sar_AddFile(GWEN_SAR *sr, const char *fname); 64 65 66 GWENHYWFAR_API 67 const GWEN_SAR_FILEHEADER_LIST *GWEN_Sar_GetHeaders(GWEN_SAR *sr); 68 69 70 GWENHYWFAR_API 71 int GWEN_Sar_ExtractFile(GWEN_SAR *sr, const GWEN_SAR_FILEHEADER *fh); 72 73 GWENHYWFAR_API 74 int GWEN_Sar_CheckFile(GWEN_SAR *sr, const GWEN_SAR_FILEHEADER *fh); 75 76 77 GWENHYWFAR_API 78 int GWEN_Sar_Sign(GWEN_SAR *sr, GWEN_CRYPTMGR *cm); 79 80 GWENHYWFAR_API 81 int GWEN_Sar_Verify(GWEN_SAR *sr, GWEN_CRYPTMGR *cm); 82 83 84 85 86 GWENHYWFAR_API 87 int GWEN_Sar_UnpackArchive(const char *inFile, const char *where); 88 89 GWENHYWFAR_API 90 int GWEN_Sar_CheckArchive(const char *inFile); 91 92 93 GWENHYWFAR_API 94 int GWEN_Sar_VerifyArchive(const char *inFile, const char *signer, GWEN_CRYPT_KEY *key); 95 96 GWENHYWFAR_API 97 int GWEN_Sar_SignArchive(const char *inFile, const char *signer, GWEN_CRYPT_KEY *key); 98 99 100 101 #endif 102 103 104 105 106 107