The Assimilation Project  based on Assimilation version
Go to the documentation of this file.
24 #ifndef _CRYPTFRAME_H
25 #define _CRYPTFRAME_H
26 #include <frame.h>
27 #include <netaddr.h>
32 typedef struct _CryptFrame CryptFrame;
34 typedef struct {
36  char* key_id;
37  int key_size;
38  int frame_type;
39  gpointer public_key;
43 typedef struct {
45  char* key_id;
46  int key_size;
47  gpointer private_key;
53 struct _CryptFrame {
55  char * sender_key_id;
57 };
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*);
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 gboolean cryptframe_set_dest_key_id(NetAddr*, const char * key_id);
81 WINEXPORT const char * cryptframe_get_dest_key_id(const NetAddr*);
82 WINEXPORT CryptFrame* cryptframe_new_by_destaddr(const NetAddr* destination_address);
84  (const char* sender_key_id, const char * receiver_key_id, gboolean forsending));
86 #endif /* _CRYPTFRAME_H */
WINEXPORT gboolean cryptframe_set_dest_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:470
WINEXPORT GList * cryptframe_get_key_ids(void)
Return a GList of strings of all known key ids.
Definition: cryptframe.c:397
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:389
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:82
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:293
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:245
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:488
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:159
WINEXPORT const char * cryptframe_whois_key_id(const char *key_id)
Return the identity associated with the given key id.
Definition: cryptframe.c:371
WINEXPORT const char * cryptframe_get_dest_key_id(const NetAddr *)
Return the key_id associated with the given destination address.
Definition: cryptframe.c:504
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:334
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:270
WINEXPORT CryptFramePrivateKey * cryptframe_private_key_by_id(const char *key_id)
Return the non-const private key with the given id.
Definition: cryptframe.c:279
Implements basic Frame class.
WINEXPORT CryptFramePrivateKey * cryptframe_get_signing_key(void)
Return the default signing key.
Definition: cryptframe.c:441
WINEXPORT void cryptframe_set_encryption_method(CryptFrame *(*)(const char *sender_key_id, const char *receiver_key_id, gboolean forsending))
WINEXPORT const char * cryptframe_whois_public_key(const CryptFramePublicKey *public_key)
Return the identity associated with the given public key object.
Definition: cryptframe.c:362
int key_size
Definition: cryptframe.h:46
Frame baseclass
Definition: cryptframe.h:54
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:453
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:416
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:380
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:434
WINEXPORT Frame * cryptframe_tlvconstructor(gpointer tlvstart, gconstpointer pktend, gpointer *, gpointer *)
Given marshalled packet data corresponding to an CryptFrame - which we can&#39;t do because we&#39;re an abst...
Definition: cryptframe.c:108
char * receiver_key_id
Definition: cryptframe.h:56
int key_size
Definition: cryptframe.h:37
WINEXPORT void cryptframe_purge_key_id(const char *key_id)
Definition: cryptframe.c:404
WINEXPORT CryptFramePublicKey * cryptframe_publickey_new(const char *key_id, gpointer public_key)
Create a persistent keypair and write it to disk.
Definition: cryptframe.c:220