encryption_infoton.h

Go to the documentation of this file.
00001 #ifndef ENCRYPTION_INFOTON_CLASS
00002 #define ENCRYPTION_INFOTON_CLASS
00003 
00004 /*****************************************************************************\
00005 *                                                                             *
00006 *  Name   : encryption_infoton                                                *
00007 *  Author : Chris Koeritz                                                     *
00008 *                                                                             *
00009 *******************************************************************************
00010 * Copyright (c) 2004-$now By Author.  This program is free software; you can  *
00011 * redistribute it and/or modify it under the terms of the GNU General Public  *
00012 * License as published by the Free Software Foundation; either version 2 of   *
00013 * the License or (at your option) any later version.  This is online at:      *
00014 *     http://www.fsf.org/copyleft/gpl.html                                    *
00015 * Please send any updates to: fred@gruntose.com                               *
00016 \*****************************************************************************/
00017 
00018 #ifndef OMIT_CRYPTO_SUPPORT
00019 
00020 #include "dll_tentacles.h"
00021 
00022 #include <octopus/entity_defs.h>
00023 #include <octopus/infoton.h>
00024 
00025 // forward.
00026 class blowfish_crypto;
00027 class RSA_crypto;
00028 
00030 
00036 class TENTACLES_CLASS_STYLE encryption_infoton : public infoton
00037 {
00038 public:
00039   byte_array _public_key;
00041 
00043   byte_array _encrypted_blowfish_key;
00045 
00048   outcome _success;  
00049 
00050   encryption_infoton(const byte_array &public_key = byte_array::empty_array(),
00051           const byte_array &encrypted_blowfish_key = byte_array::empty_array());
00052   encryption_infoton(const encryption_infoton &to_copy);
00053 
00054   virtual ~encryption_infoton();
00055 
00056   IMPLEMENT_CLASS_NAME("encryption_infoton");
00057 
00058   static const int RSA_KEY_SIZE;
00060   static const int BLOWFISH_KEY_SIZE;
00062 
00063   encryption_infoton &operator =(const encryption_infoton &to_copy);
00064 
00065   outcome prepare_blowfish_key(blowfish_crypto &new_key);
00067 
00071   outcome prepare_public_key(const RSA_crypto &private_key);
00073 
00075   outcome prepare_both_keys(RSA_crypto &private_key);
00077 
00078   outcome extract_response(const RSA_crypto &private_key,
00079           blowfish_crypto &new_key) const;
00081 
00085   static const string_array &encryption_classifier();
00087 
00088   virtual void pack(byte_array &packed_form) const;
00089   virtual bool unpack(byte_array &packed_form);
00090 
00091   virtual clonable *clone() const;
00092 
00093   virtual int packed_size() const;
00094 };
00095 
00096 #endif  // crypto support.
00097 
00098 #endif  // outer guard.
00099 

Generated on Fri Nov 28 04:29:32 2008 for HOOPLE Libraries by  doxygen 1.5.1