The Assimilation Project
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cryptframe.h
Go to the documentation of this file.
1 
24 #ifndef _CRYPTFRAME_H
25 #define _CRYPTFRAME_H
26 #include <frame.h>
27 #include <netaddr.h>
28 
31 #define MAXCRYPTKEYNAMELENGTH 64
32 typedef struct _CryptFrame CryptFrame;
33 
34 typedef struct {
36  char* key_id;
37  int key_size;
38  int frame_type;
39  gpointer public_key;
42 
43 typedef struct {
45  char* key_id;
46  int key_size;
47  gpointer private_key;
49 
50 
51 
53 struct _CryptFrame {
55  char * sender_key_id;
57 };
58 
59 CryptFrame* cryptframe_new(guint16 frame_type, const char *sender_key_id, const char * receiver_key_id
60 , gsize framesize);
61 WINEXPORT Frame* cryptframe_tlvconstructor(gpointer tlvstart, gconstpointer pktend, gpointer*,gpointer*);
62 
65 WINEXPORT CryptFramePublicKey* cryptframe_publickey_new (const char *key_id, gpointer public_key);
66 WINEXPORT CryptFramePrivateKey* cryptframe_privatekey_new(const char *key_id, gpointer private_key);
67 WINEXPORT gboolean cryptframe_associate_identity(const char * identity, const char * key_id);
68 WINEXPORT gboolean cryptframe_dissociate_identity(const char * identity, const char * key_id);
69 WINEXPORT void cryptframe_purge_key_id(const char * key_id);
70 WINEXPORT const char* cryptframe_whois_public_key(const CryptFramePublicKey* public_key);
71 WINEXPORT const char* cryptframe_whois_key_id(const char * key_id);
72 WINEXPORT GHashTable* cryptframe_key_ids_for(const char* identity);
73 WINEXPORT GList* cryptframe_get_identities(void); // List of String values
74 WINEXPORT GList* cryptframe_get_key_ids(void); // List of String values
76 WINEXPORT void cryptframe_set_signing_key_id(const char * key_id);
77 WINEXPORT const char * cryptframe_get_signing_key_id(void);
80 WINEXPORT void cryptframe_set_dest_public_key_id(NetAddr*, const char * key_id);
81 WINEXPORT CryptFrame* cryptframe_new_by_destaddr(const NetAddr* destination_address);
83  (const char* sender_key_id, const char * receiver_key_id));
85 #endif /* _CRYPTFRAME_H */
WINEXPORT GList * cryptframe_get_key_ids(void)
Return a GList of strings of all known key ids.
Definition: cryptframe.c:364
WINEXPORT void cryptframe_set_encryption_method(CryptFrame *(*)(const char *sender_key_id, const char *receiver_key_id))
int frame_type
FrameType of this type of public key (we never send private keys - no symmetry here) ...
Definition: cryptframe.h:38
WINEXPORT GList * cryptframe_get_identities(void)
Return a GList of strings of all known identities.
Definition: cryptframe.c:356
CryptFrame * cryptframe_new(guint16 frame_type, const char *sender_key_id, const char *receiver_key_id, gsize framesize)
Construct a new CryptFrame This can only be used directly for creating subclassed CryptFrame frames b...
Definition: cryptframe.c:80
char * sender_key_id
Definition: cryptframe.h:55
This is the base Frame class object (in-memory TLV (type, length, value)) for every general component...
Definition: frame.h:43
WINEXPORT gboolean cryptframe_associate_identity(const char *identity, const char *key_id)
Associate the given key id with the given identity Note that it is OK to associate multiple key ids w...
Definition: cryptframe.c:269
WINEXPORT CryptFramePrivateKey * cryptframe_privatekey_new(const char *key_id, gpointer private_key)
Create a new private key - or return the existing private key with this id.
Definition: cryptframe.c:223
#define WINEXPORT
Definition: projectcommon.h:45
char * key_id
unique name for this key
Definition: cryptframe.h:36
WINEXPORT CryptFrame * cryptframe_new_by_destaddr(const NetAddr *destination_address)
Construct a CryptFrame class appropriate for encrypting messages to destaddr
Definition: cryptframe.c:449
gpointer private_key
Pointer to the (malloced) private key.
Definition: cryptframe.h:47
WINEXPORT void cryptframe_shutdown(void)
Shut down our key caches and so on... (destroy our maps)
Definition: cryptframe.c:152
WINEXPORT const char * cryptframe_whois_key_id(const char *key_id)
Return the identity associated with the given key id.
Definition: cryptframe.c:340
WINEXPORT gboolean cryptframe_dissociate_identity(const char *identity, const char *key_id)
Dissociate the given key from the given identity (analogous to revoking the key)
Definition: cryptframe.c:305
char * key_id
unique name for this key
Definition: cryptframe.h:45
WINEXPORT CryptFramePublicKey * cryptframe_public_key_by_id(const char *key_id)
Return the non-const public key with the given id.
Definition: cryptframe.c:246
WINEXPORT CryptFramePrivateKey * cryptframe_private_key_by_id(const char *key_id)
Return the non-const private key with the given id.
Definition: cryptframe.c:255
Implements basic Frame class.
WINEXPORT CryptFramePrivateKey * cryptframe_get_signing_key(void)
Return the default signing key.
Definition: cryptframe.c:408
WINEXPORT const char * cryptframe_whois_public_key(const CryptFramePublicKey *public_key)
Return the identity associated with the given public key object.
Definition: cryptframe.c:331
int key_size
sizeof(private_key)
Definition: cryptframe.h:46
Frame baseclass
Definition: cryptframe.h:54
WINEXPORT void cryptframe_set_dest_public_key_id(NetAddr *, const char *key_id)
Set the encryption key to use when sending to destaddr Set destkey to NULL to stop encrypting to that...
Definition: cryptframe.c:436
The NetAddr class class represents a general network address - whether IP, MAC, or any other type of ...
Definition: netaddr.h:43
Defines interfaces for the NetAddr (network address) object.
WINEXPORT void cryptframe_set_dest_public_key(NetAddr *, CryptFramePublicKey *)
Set the encryption key to use when sending to destaddr Set destkey to NULL to stop encrypting to that...
Definition: cryptframe.c:419
AssimObj baseclass
Definition: cryptframe.h:35
WINEXPORT void cryptframe_set_signing_key_id(const char *key_id)
Set the default signing key.
Definition: cryptframe.c:383
WINEXPORT GHashTable * cryptframe_key_ids_for(const char *identity)
Return a GHashTable of strings of all the key ids associated with the given identity.
Definition: cryptframe.c:348
This is our CryptFrame class object - representing an encryption method.
Definition: cryptframe.h:53
WINEXPORT const char * cryptframe_get_signing_key_id(void)
Return the key_id of the default signing key.
Definition: cryptframe.c:401
WINEXPORT Frame * cryptframe_tlvconstructor(gpointer tlvstart, gconstpointer pktend, gpointer *, gpointer *)
Given marshalled packet data corresponding to an CryptFrame - which we can't do because we're an abst...
Definition: cryptframe.c:104
char * receiver_key_id
Definition: cryptframe.h:56
int key_size
sizeof(public_key)
Definition: cryptframe.h:37
WINEXPORT void cryptframe_purge_key_id(const char *key_id)
Definition: cryptframe.c:371
WINEXPORT CryptFramePublicKey * cryptframe_publickey_new(const char *key_id, gpointer public_key)
Create a new public key - or return the existing public key with this id.
Definition: cryptframe.c:200