home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1998 February / PCOnline_02_1998.iso / filesbbs / os2 / pgp263.arj / PGP263I.SRC / PGP263II.ZIP / src / keymgmt.h < prev    next >
C/C++ Source or Header  |  1995-10-29  |  4KB  |  113 lines

  1. /* keymgmt.h - headers for keymgmt.c 
  2. */
  3.  
  4. #include "idea.h" /* Declaration of IdeaCfbContext */
  5.  
  6. /*    Return printable public key fragment. */
  7. char *keyIDstring(byte *keyID);
  8. char *key2IDstring(unitptr n);
  9. extern char const blankkeyID[];
  10.  
  11. /* Do an RSA key pair generation, and write them out to the keyring files. */
  12. int dokeygen(char *numstr, char *numstr2, char *username);
  13.  
  14. /* Edit the userid and/or pass phrase for an RSA key pair, and put them    back
  15.    into the ring files */
  16. int dokeyedit(char *mcguffin, char *ringfile);
  17.  
  18. /* Copy the first entry in key ring that has mcguffin string in userid and
  19.    put it into keyfile */
  20. int extract_from_keyring (char *mcguffin, char *keyfile, char *ringfile,
  21.                           boolean transflag);
  22.  
  23. /* Lists all entries in keyring that have mcguffin string in userid */
  24. int view_keyring(char *mcguffin, char *ringfile,
  25.          boolean show_signatures, boolean show_hashes);
  26.  
  27. /* Signature-check all entries in keyring that have mcguffin string
  28.    in userid */
  29. int dokeycheck(char *mcguffin, char *ringfile, int options);
  30. /* options: */
  31. #define    CHECK_ALL    0    /* Check all signatures */
  32. #define CHECK_NEW    1    /* Only check new signatures */
  33.  
  34. /* Allow user to remove signatures from keys in keyring that have mcguffin */
  35. int remove_sigs(char *mcguffin, char *ringfile);
  36.  
  37. /* Remove the first entry in key ring that has mcguffin string in userid */
  38. int remove_from_keyring(byte *keyID, char *mcguffin,
  39.             char *ringfile, boolean secring_too);
  40.  
  41. /* Extract key fragment from modulus n */
  42. void extract_keyID(byteptr keyID, unitptr n);
  43.  
  44. /* Write message prefix keyID to a file */
  45. void writekeyID(unitptr n, FILE *f);
  46.  
  47. /* Extract public key corresponding to keyID or userid from keyfile */
  48. int getpublickey(int flags, char *keyfile,
  49.          long *file_position, int *pktlen, byte *keyID,
  50.          byte *timestamp, byte *userid, unitptr n,
  51.          unitptr e);
  52. /* flags: */
  53. #define    GPK_GIVEUP    1
  54. #define    GPK_SHOW    2
  55. #define    GPK_NORVK    4
  56. #define    GPK_DISABLED    8
  57. /* Flag used in getsecretkey() only - should it be GSK_? */
  58. /* Prevents use of existing password list. */
  59. #define GPK_ASKPASS    16
  60. #define GPK_SECRET    32    /* We are actually getting a secret key */
  61.  
  62. #ifdef MACTC5
  63. int getfirstsecretkey(boolean giveup, boolean showkey, char *keyfile, byte *keyID,
  64.     byte *timestamp, char *passp, boolean *hkey,
  65.     byte *userid, unitptr n, unitptr e, unitptr d, unitptr p, unitptr q,
  66.     unitptr u);
  67. #endif
  68.  
  69. /* Extract private key corresponding to keyID or userid from keyfile */
  70. int getsecretkey(int flags, char *keyfile, byte *keyID, byte *timestamp,
  71.             byte *hpass, boolean *hkey, byte *userid,
  72.             unitptr n, unitptr e, unitptr d, unitptr p, unitptr q,
  73.             unitptr u);
  74.  
  75. /* Return true if ctb is one for a key in a keyring */
  76. int is_key_ctb (byte ctb);
  77.  
  78. /* Read next key packet from file f, return its ctb in *pctb, and advance
  79.  * the file pointer to point beyond the key packet.
  80.  */
  81. short nextkeypacket(FILE *f, byte *pctb);
  82.  
  83. /* Read the next key packet from file f, return info about it in the various
  84.  * pointers.  Most pointers can be NULL without breaking it.
  85.  */
  86. short readkeypacket(FILE *f, struct IdeaCfbContext *cfb, byte *pctb,
  87.     byte *timestamp, char *userid,
  88.     unitptr n ,unitptr e, unitptr d, unitptr p, unitptr q, unitptr u,
  89.     byte *sigkeyID, byte *keyctrl);
  90.  
  91. /* Starting at key_position in keyfile, scan for the userid packet which
  92.  * matches C string userid.  Return the packet position and size.
  93.  */
  94. int getpubuserid(char *keyfile, long key_position, byte *userid,
  95.     long *userid_position, int *userid_len, boolean exact_match);
  96.  
  97. int getpubusersig(char *keyfile, long user_position, byte *sigkeyID,
  98.     byte *timestamp, long *sig_position, int *sig_len);
  99.  
  100. void getKeyHash( byte *hash, unitptr n, unitptr e );
  101. void printKeyHash( byteptr hash, boolean indent );
  102.  
  103. extern int is_compromised(FILE *f);
  104.  
  105. int disable_key(char *, char *);
  106.  
  107. void kv_title(FILE *fo);
  108.  
  109. int  kvformat_keypacket(FILE *f, FILE *pgpout, boolean one_key,
  110.                         char *mcguffin, char *ringfile,
  111.                         boolean show_signatures, boolean show_hashes,
  112.                         int *keycounter);
  113.