--- pgp/src/keymgmt.h 2018/04/24 16:38:36 1.1.1.2 +++ pgp/src/keymgmt.h 2018/04/24 16:40:07 1.1.1.4 @@ -21,8 +21,10 @@ int extract_from_keyring (char *mcguffin int view_keyring(char *mcguffin, char *ringfile, boolean show_signatures, boolean show_hashes); /* Signature-check all entries in keyring that have mcguffin string in userid */ -/* or if chk_keyID is not NULL, all signatures made by the key with this keyID */ -int dokeycheck(char *mcguffin, char *ringfile, byte *chk_keyID); +int dokeycheck(char *mcguffin, char *ringfile, int options); +/* options: */ +#define CHECK_ALL 0 /* Check all signatures */ +#define CHECK_NEW 1 /* Only check new signatures */ /* Allow user to remove signatures from keys in keyring that have mcguffin */ int remove_sigs(char *mcguffin, char *ringfile); @@ -30,9 +32,6 @@ int remove_sigs(char *mcguffin, char *ri /* Remove the first entry in key ring that has mcguffin string in userid */ int remove_from_keyring(byte *keyID, char *mcguffin, char *ringfile, boolean secring_too); -/* Adds (prepends) key file to key ring file */ -int addto_keyring(char *keyfile, char *ringfile, boolean query); - /* Extract key fragment from modulus n */ void extract_keyID(byteptr keyID, unitptr n); @@ -40,15 +39,23 @@ void extract_keyID(byteptr keyID, unitpt void writekeyID(unitptr n, FILE *f); /* Extract public key corresponding to keyID or userid from keyfile */ -int getpublickey(boolean giveup, boolean showkey, char *keyfile, +int getpublickey(int flags, char *keyfile, long *file_position, int *pktlen, byte *keyID, byte *timestamp, byte *userid, unitptr n, unitptr e); +/* flags: */ +#define GPK_GIVEUP 1 +#define GPK_SHOW 2 +#define GPK_NORVK 4 +#define GPK_DISABLED 8 +/* Flag used in getsecretkey() only - should it be GSK_? */ +/* Prevents use of existing password list. */ +#define GPK_ASKPASS 16 /* Extract private key corresponding to keyID or userid from keyfile */ -int getsecretkey(boolean giveup, boolean showkey, char *keyfile, byte *keyID, - byte *timestamp, char *passp, boolean *hkey, byte *userid, - unitptr n, unitptr e, unitptr d, unitptr p, unitptr q, - unitptr u); +int getsecretkey(int flags, char *keyfile, byte *keyID, byte *timestamp, + byte *hpass, boolean *hkey, byte *userid, + unitptr n, unitptr e, unitptr d, unitptr p, unitptr q, + unitptr u); /* Return true if ctb is one for a key in a keyring */ int is_key_ctb (byte ctb); @@ -75,19 +82,9 @@ int getpubuserid(char *keyfile, long key int getpubusersig(char *keyfile, long user_position, byte *sigkeyID, long *sig_position, int *sig_len); -/* Write key control packet */ -void write_trust (FILE *f, byte trustbyte); - -int read_trust(FILE *f, byte *keyctrl); - -int ask_owntrust(char *userid, byte cur_trust); - -int readkpacket(FILE *f, byte *ctb, char *userid, byte *keyID, byte *sigkeyID); +void getKeyHash( byte *hash, unitptr n, unitptr e ); +void printKeyHash( byteptr hash, boolean indent ); -/* Show key in file f at keypos */ -int show_key(FILE *f, long keypos, int what); +extern int is_compromised(FILE *f); -/* possible values for 'what' */ -#define SHOW_TRUST 1 -#define SHOW_SIGS 2 -#define SHOW_ALL (SHOW_TRUST|SHOW_SIGS) +int disable_key(char *, char *);