The Assimilation Project
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cryptframe.c File Reference

Implements the CryptFrame class class - A Frame for encrypting packets. More...

#include <string.h>
#include <projectcommon.h>
#include <frameset.h>
#include <cryptframe.h>
#include <frametypes.h>
#include <generic_tlv_min.h>
#include <tlvhelper.h>
#include <misc.h>
#include <sodium.h>
Include dependency graph for cryptframe.c:

Go to the source code of this file.

Macros

#define INITMAPS   {if (!maps_inityet) {_cryptframe_initialize_maps();}}
 

Functions

FSTATIC gboolean _cryptframe_default_isvalid (const Frame *self,gconstpointer tlvptr,gconstpointer pktend)
 CryptFrame class 'isvalid' member function (checks for valid cryptframe objects) More...
 
FSTATIC void _cryptframe_finalize (AssimObj *aself)
 Finalize (destructor) function for our CryptFramePublicKey objects. More...
 
FSTATIC CryptFramePublicKeycryptframe_public_key_by_id (const char *key_id)
 Return the non-const public key with the given id. More...
 
FSTATIC CryptFramePrivateKeycryptframe_private_key_by_id (const char *key_id)
 Return the non-const private key with the given id. More...
 
CryptFramecryptframe_new (guint16 frame_type, const char *sender_key_id, const char *receiver_key_id, gsize objsize)
 Construct a new CryptFrame This can only be used directly for creating subclassed CryptFrame frames because CryptFrame is an abstract class... More...
 
WINEXPORT Framecryptframe_tlvconstructor (gpointer tlvstart, gconstpointer pktend, gpointer *ignorednewpkt, gpointer *ignoredpktend)
 Given marshalled packet data corresponding to an CryptFrame - which we can't do because we're an abstract class... More...
 
FSTATIC void _cryptframe_publickey_finalize (AssimObj *pubkey)
 Finalize (destructor) function for our CryptFramePublicKey objects. More...
 
FSTATIC void _cryptframe_privatekey_finalize (AssimObj *privkey)
 Finalize (destructor) function for our CryptFramePrivateKey objects. More...
 
FSTATIC void _cryptframe_initialize_maps (void)
 Initialize all our maps. More...
 
WINEXPORT void cryptframe_shutdown (void)
 Shut down our key caches and so on... (destroy our maps) More...
 
WINEXPORT CryptFramePublicKeycryptframe_publickey_new (const char *key_id, gpointer public_key)
 Create a new public key - or return the existing public key with this id. More...
 
WINEXPORT CryptFramePrivateKeycryptframe_privatekey_new (const char *key_id, gpointer private_key)
 Create a new private key - or return the existing private key with this id. More...
 
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 with a given identity but it is NOT OK to associate multiple identities with a given key id Return TRUE if we could make the association (it's OK to make the same valid association multiple times) More...
 
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) More...
 
WINEXPORT const char * cryptframe_whois_public_key (const CryptFramePublicKey *public_key)
 Return the identity associated with the given public key object. More...
 
WINEXPORT const char * cryptframe_whois_key_id (const char *key_id)
 Return the identity associated with the given key id. More...
 
WINEXPORT GHashTable * cryptframe_key_ids_for (const char *identity)
 Return a GHashTable of strings of all the key ids associated with the given identity. More...
 
WINEXPORT GList * cryptframe_get_identities (void)
 Return a GList of strings of all known identities. More...
 
WINEXPORT GList * cryptframe_get_key_ids (void)
 Return a GList of strings of all known key ids. More...
 
WINEXPORT void cryptframe_purge_key_id (const char *key_id)
 
WINEXPORT void cryptframe_set_signing_key_id (const char *key_id)
 Set the default signing key. More...
 
WINEXPORT const char * cryptframe_get_signing_key_id (void)
 Return the key_id of the default signing key. More...
 
WINEXPORT CryptFramePrivateKeycryptframe_get_signing_key (void)
 Return the default signing key. More...
 
WINEXPORT void cryptframe_set_dest_public_key (NetAddr *destaddr, CryptFramePublicKey *destkey)
 Set the encryption key to use when sending to destaddr Set destkey to NULL to stop encrypting to that destination. More...
 
WINEXPORT void cryptframe_set_dest_public_key_id (NetAddr *destaddr, const char *key_id)
 Set the encryption key to use when sending to destaddr Set destkey to NULL to stop encrypting to that destination. More...
 
WINEXPORT CryptFramecryptframe_new_by_destaddr (const NetAddr *destaddr)
 Construct a CryptFrame class appropriate for encrypting messages to destaddr More...
 
WINEXPORT void cryptframe_set_encryption_method (CryptFrame *(*method)(const char *sender_key_id, const char *receiver_key_id))
 

Variables

GHashTable * addr_to_public_key_map = NULL
 Maps NetAddr class to public key. More...
 

Detailed Description

Implements the CryptFrame class class - A Frame for encrypting packets.

This frame cannot be usefully subclassed because of restrictions in FrameSets. There are currently no implementations of encryption as of now.

This file is part of the Assimilation Project.

Author
Copyright © 2011, 2012 - Alan Robertson alanr.nosp@m.@uni.nosp@m.x.sh
The Assimilation software is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Assimilation software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with the Assimilation Project software. If not, see http://www.gnu.org/licenses/

Definition in file cryptframe.c.