feisty meow concerns codebase 2.140
encryption_infoton.h
Go to the documentation of this file.
1#ifndef ENCRYPTION_INFOTON_CLASS
2#define ENCRYPTION_INFOTON_CLASS
3
4/*****************************************************************************\
5* *
6* Name : encryption_infoton *
7* Author : Chris Koeritz *
8* *
9*******************************************************************************
10* Copyright (c) 2004-$now By Author. This program is free software; you can *
11* redistribute it and/or modify it under the terms of the GNU General Public *
12* License as published by the Free Software Foundation; either version 2 of *
13* the License or (at your option) any later version. This is online at: *
14* http://www.fsf.org/copyleft/gpl.html *
15* Please send any updates to: fred@gruntose.com *
16\*****************************************************************************/
17
19#include <crypto/rsa_crypto.h>
20#include <octopus/entity_defs.h>
21#include <octopus/infoton.h>
22
23namespace octopi {
24
26
33{
34public:
37
41
45
47 const basis::byte_array &encrypted_blowfish_key = basis::byte_array::empty_array());
49
50 virtual ~encryption_infoton();
51
52 DEFINE_CLASS_NAME("encryption_infoton");
53
54 static const int RSA_KEY_SIZE;
56 static const int BLOWFISH_KEY_SIZE;
58
59 void text_form(basis::base_string &fill) const {
60 fill.assign(basis::astring(class_name())); // low exposure for vital held info.
61 }
62
64
67
73
77
79 crypto::blowfish_crypto &new_key) const;
81
87
88 virtual void pack(basis::byte_array &packed_form) const;
89 virtual bool unpack(basis::byte_array &packed_form);
90
91 virtual clonable *clone() const;
92
93 virtual int packed_size() const;
94};
95
96} //namespace.
97
98#endif // outer guard.
99
Provides a dynamically resizable ASCII character string.
Definition astring.h:35
Defines the base class for all string processing objects in hoople.
Definition base_string.h:28
virtual base_string & assign(const base_string &s)=0
Sets the contents of this string to "s".
A very common template for a dynamic array of bytes.
Definition byte_array.h:36
static const byte_array & empty_array()
Definition byte_array.h:57
Outcomes describe the state of completion for an operation.
Definition outcome.h:31
virtual const char * class_name() const =0
Returns the bare name of this class as a constant character pointer.
Provides BlowFish encryption on byte_arrays using the OpenSSL package.
Supports public key encryption and decryption.
Definition rsa_crypto.h:33
Encapsulates the chit-chat necessary to establish an encrypted connection.
basis::outcome prepare_public_key(const crypto::rsa_crypto &private_key)
prepares the request side for a client.
encryption_infoton & operator=(const encryption_infoton &to_copy)
basis::outcome extract_response(const crypto::rsa_crypto &private_key, crypto::blowfish_crypto &new_key) const
used by the client to extract the shared blowfish key from the server.
DEFINE_CLASS_NAME("encryption_infoton")
virtual int packed_size() const
reports how large the infoton will be when packed.
basis::outcome prepare_both_keys(crypto::rsa_crypto &private_key)
sets up both keys by randomly generating the "private_key".
basis::byte_array _public_key
valid during the request stage of encryption.
basis::outcome prepare_blowfish_key(crypto::blowfish_crypto &new_key)
performs the server side's job on the current key.
virtual clonable * clone() const
must be provided to allow creation of a copy of this object.
static const structures::string_array & encryption_classifier()
returns the classifier for this type of infoton.
basis::outcome _success
did the request succeed?
static const int RSA_KEY_SIZE
this key size should be used for all RSA private keys.
virtual void pack(basis::byte_array &packed_form) const
stuffs the data in the infoton into the "packed_form".
static const int BLOWFISH_KEY_SIZE
this will be used for blowfish keys that this object generates.
basis::byte_array _encrypted_blowfish_key
valid during the response stage of encryption.
void text_form(basis::base_string &fill) const
requires derived infotons to be able to show their state as a string.
virtual bool unpack(basis::byte_array &packed_form)
restores an infoton from a packed form.
An infoton is an individual request parcel with accompanying information.
Definition infoton.h:32
An array of strings with some additional helpful methods.