X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/8ef2f81dfbf105ae89082a340ac56f46368387f0..1ba83484ee5bb486da9aa958576de4bc29ef0c1d:/key-data.h diff --git a/key-data.h b/key-data.h index 4ee99aa..4eb8845 100644 --- a/key-data.h +++ b/key-data.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: key-data.h,v 1.2 2000/06/17 11:26:18 mdw Exp $ + * $Id: key-data.h,v 1.3 2004/03/28 01:58:47 mdw Exp $ * * Manipulating key data * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: key-data.h,v $ + * Revision 1.3 2004/03/28 01:58:47 mdw + * Generate, store and retreive elliptic curve keys. + * * Revision 1.2 2000/06/17 11:26:18 mdw * Add the key packing interface. * @@ -57,6 +60,10 @@ # include "mp.h" #endif +#ifndef CATACOMB_EC_H +# include "ec.h" +#endif + /*----- Data structures ---------------------------------------------------*/ /* --- Key binary data --- */ @@ -74,6 +81,8 @@ typedef struct key_data { key_bin k; /* Binary key data */ mp *m; /* Multiprecision integer */ sym_table s; /* Structured key data */ + char *p; /* String pointer */ + ec e; /* Elliptic curve point */ } u; } key_data; @@ -118,11 +127,13 @@ enum { /* --- Bottom two bits are the encoding type --- */ - KF_ENCMASK = 0x03, /* Encoding mask */ + KF_ENCMASK = 0x83, /* Encoding mask */ KENC_BINARY = 0x00, /* Plain binary key (@k@) */ KENC_MP = 0x01, /* Multiprecision integer (@i@) */ KENC_STRUCT = 0x02, /* Structured key data (@s@) */ KENC_ENCRYPT = 0x03, /* Encrypted key type (@k@) */ + KENC_STRING = 0x80, /* ASCII string (@p@) */ + KENC_EC = 0x81, /* Elliptic curve point (@e@) */ /* --- Key category bits --- */ @@ -239,6 +250,30 @@ extern void key_encrypted(key_data */*k*/, const void */*p*/, size_t /*sz*/); extern void key_mp(key_data */*k*/, mp */*m*/); +/* --- @key_string@ --- * + * + * Arguments: @key_data *k@ = pointer to key data block + * @const char *p@ = pointer to the value to set + * + * Returns: --- + * + * Use: Sets a plain string in a key block. + */ + +extern void key_string(key_data */*k*/, const char */*p*/); + +/* --- @key_ec@ --- * + * + * Arguments: @key_data *k@ = pointer to key data block + * @const ec *e@ = pointer to the value to set + * + * Returns: --- + * + * Use: Sets an elliptic curve point in a key block. + */ + +extern void key_ec(key_data */*k*/, const ec */*e*/); + /* --- @key_structure@ --- * * * Arguments: @key_data *k@ = pointer to key data block