michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef SIGNTOOL_H michael@0: #define SIGNTOOL_H michael@0: michael@0: #define DJN_TEST michael@0: michael@0: #include michael@0: #include michael@0: #include michael@0: michael@0: #include "prprf.h" michael@0: #include "prio.h" michael@0: #include "secutil.h" michael@0: #include "ocsp.h" michael@0: #include "jar.h" michael@0: #include "jarfile.h" michael@0: #include "secpkcs7.h" michael@0: #include "pk11func.h" michael@0: #include "secmod.h" michael@0: #include "plhash.h" michael@0: #include "nss.h" michael@0: michael@0: #ifdef _UNIX michael@0: #include michael@0: #endif michael@0: michael@0: /********************************************************************** michael@0: * General Defines michael@0: */ michael@0: #define JAR_BASE_END JAR_BASE + 100 michael@0: #define ERRX (-1) /* the exit code used on failure */ michael@0: #define FNSIZE 256 /* the maximum length for filenames */ michael@0: #define MAX_RSA_KEY_SIZE 4096 michael@0: #define DEFAULT_RSA_KEY_SIZE 1024 michael@0: #define MANIFEST "manifest.mf" michael@0: #define DEFAULT_X509_BASENAME "x509" michael@0: #define DEFAULT_COMMON_NAME "Signtool " NSS_VERSION " Testing Certificate" michael@0: #define CREATOR "Signtool (signtool " NSS_VERSION ")" michael@0: #define BREAKAGE "PLEASE DO NOT EDIT THIS FILE. YOU WILL BREAK IT." michael@0: #define MIN_COMPRESSION_LEVEL (-1) michael@0: #define MAX_COMPRESSION_LEVEL 9 michael@0: #define DEFAULT_COMPRESSION_LEVEL (-1) /* zlib understands this to be default*/ michael@0: #define STDIN_BUF_SIZE 160 michael@0: #define PROGRAM_NAME "signtool" michael@0: #define LONG_PROGRAM_NAME "Signing Tool" michael@0: #define DEFAULT_BASE_NAME "zigbert" michael@0: #define TMP_OUTPUT "signtool.tmp" michael@0: #define XPI_TEXT "Creating XPI Compatible Archive" michael@0: michael@0: /*************************************************************** michael@0: * Main Task Functions michael@0: */ michael@0: int GenerateCert(char *nickname, int keysize, char *token); michael@0: int ListCerts(char *key, int list_certs); michael@0: int VerifyJar(char *filename); michael@0: int SignArchive(char *tree, char *keyName, char *zip_file, int javascript, michael@0: char *meta_file, char *install_script, int _optimize, PRBool recurse); michael@0: int SignAllArc(char *jartree, char *keyName, int javascript, char *metafile, michael@0: char *install_script, int optimize, PRBool recurse); michael@0: int InlineJavaScript(char *dir, PRBool recurse); michael@0: int JarWho(char *filename); michael@0: void JarListModules(void); michael@0: michael@0: /************************************************************** michael@0: * Utility Functions michael@0: */ michael@0: CERTCertDBHandle *OpenCertDB (PRBool readOnly); michael@0: michael@0: int RemoveAllArc(char *tree); michael@0: void VerifyCertDir(char *dir, char *keyName); michael@0: int InitCrypto(char *cert_dir, PRBool readOnly); michael@0: int foreach (char *dirname, char *prefix, michael@0: int (*fn)(char *filename, char *dirname, char *basedir,char *base,void*arg), michael@0: PRBool recurse, PRBool includeDirs, void *arg); michael@0: void print_error (int i); michael@0: void give_help (int status); michael@0: const char* secErrorString(long code); michael@0: void displayVerifyLog(CERTVerifyLog *log); michael@0: void Usage (void); michael@0: void LongUsage (void); michael@0: char* chop(char*); michael@0: void out_of_memory(void); michael@0: void FatalError(char *msg); michael@0: char* get_default_cert_dir(void); michael@0: SECItem *password_hardcode(void *arg, void *handle); michael@0: char* pk11_password_hardcode(PK11SlotInfo *slot, PRBool retry, void *arg); michael@0: int rm_dash_r(char *path); michael@0: char* pr_fgets(char *buf, int size, PRFileDesc *file); michael@0: michael@0: michael@0: /***************************************************************** michael@0: * Global Variables (*gag*) michael@0: */ michael@0: extern char *password; /* the password passed in on the command line */ michael@0: extern PLHashTable *excludeDirs; /* directory entry to skip while recursing */ michael@0: extern int no_time; michael@0: extern int xpi_arc; michael@0: extern char *base; /* basename of ".rsa" and ".sf" files */ michael@0: extern long *mozilla_event_queue; michael@0: extern char *progName; /* argv[0] */ michael@0: extern PLHashTable *extensions;/* only sign files with this extension */ michael@0: extern PRBool extensionsGiven; michael@0: extern char *scriptdir; michael@0: extern int compression_level; michael@0: extern PRFileDesc *outputFD, *errorFD; michael@0: extern int verbosity; michael@0: extern int errorCount; michael@0: extern int warningCount; michael@0: extern secuPWData pwdata; michael@0: michael@0: #endif /* SIGNTOOL_H */