2
* The contents of this file are subject to the Mozilla Public
3
* License Version 1.1 (the "License"); you may not use this file
4
* except in compliance with the License. You may obtain a copy of
5
* the License at http://www.mozilla.org/MPL/
7
* Software distributed under the License is distributed on an "AS
8
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9
* implied. See the License for the specific language governing
10
* rights and limitations under the License.
12
* The Original Code is the Netscape security libraries.
14
* The Initial Developer of the Original Code is Netscape
15
* Communications Corporation. Portions created by Netscape are
16
* Copyright (C) 1994-2000 Netscape Communications Corporation. All
21
* Alternatively, the contents of this file may be used under the
22
* terms of the GNU General Public License Version 2 or later (the
23
* "GPL"), in which case the provisions of the GPL are applicable
24
* instead of those above. If you wish to allow use of your
25
* version of this file only under the terms of the GPL and not to
26
* allow others to use your version of this file under the MPL,
27
* indicate your decision by deleting the provisions above and
28
* replace them with the notice and other provisions required by
29
* the GPL. If you do not delete the provisions above, a recipient
30
* may use your version of this file under either the MPL or the
34
/* JAR internal routines */
38
/* definitely required */
39
/*#include "certdb.h" */
43
extern CERTCertDBHandle *JAR_open_database (void);
45
extern int JAR_close_database (CERTCertDBHandle *certdb);
47
extern int jar_close_key_database (void *keydb);
49
extern void *jar_open_key_database (void);
51
extern JAR_Signer *JAR_new_signer (void);
53
extern void JAR_destroy_signer (JAR_Signer *signer);
55
extern JAR_Signer *jar_get_signer (JAR *jar, char *basename);
57
extern int jar_append (ZZList *list, int type,
58
char *pathname, void *data, size_t size);
60
/* Translate fopen mode arg to PR_Open flags and mode */
62
JAR_FOPEN_to_PR_Open(const char *name, const char *mode);
65
#define ADDITEM(list,type,pathname,data,size) \
66
{ int err; err = jar_append (list, type, pathname, data, size); \
67
if (err < 0) return err; }
69
/* Here is some ugliness in the event it is necessary to link
70
with NSPR 1.0 libraries, which do not include an FSEEK. It is
71
difficult to fudge an FSEEK into 1.0 so we use stdio. */
75
#define JAR_FILE FILE *
76
#define JAR_FOPEN(fn,mode) fopen(fn,mode)
77
#define JAR_FCLOSE fclose
78
#define JAR_FSEEK fseek
79
#define JAR_FREAD(fp,buf,siz) fread(buf,1,siz,fp)
80
#define JAR_FWRITE(fp,buf,siz) fwrite(buf,1,siz,fp)
85
#define JAR_FILE PRFileHandle
86
#define JAR_FOPEN(fn,mode) PR_OpenFile(fn,0,mode)
87
#define JAR_FCLOSE PR_CLOSE
88
#define JAR_FSEEK (no-equivalent)
89
#define JAR_FREAD PR_READ
90
#define JAR_FWRITE PR_WRITE
94
#define JAR_FILE PRFileDesc *
95
/* #define JAR_FOPEN(fn,mode) PR_Open(fn,0,0) */
96
#define JAR_FOPEN(fn,mode) JAR_FOPEN_to_PR_Open(fn,mode)
97
#define JAR_FCLOSE PR_Close
98
#define JAR_FSEEK PR_Seek
99
#define JAR_FREAD PR_Read
100
#define JAR_FWRITE PR_Write
103
/* nav XP suite, note argument order */
104
#define JAR_FILE XP_File
105
#define JAR_FOPEN(fn,mode) XP_FileOpen(fn,xpURL,mode)
106
#define JAR_FCLOSE XP_FileClose
107
#define JAR_FSEEK XP_FileSeek
108
#define JAR_FREAD(fp,buf,siz) XP_FileRead(buf,siz,fp)
109
#define JAR_FWRITE(fp,buf,siz) XP_FileWrite(buf,siz,fp)
113
(CERTCertDBHandle *certdb, void *keydb,
114
CERTCertificate *cert, char *password, JAR_FILE infp,