25 using namespace basis;
34 #define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), s)
36 #define DEBUG_ENCRYPTION_TENTACLE
41 encryption_tentacle::encryption_tentacle()
77 {
return *_rsa_private; }
108 #ifdef DEBUG_ENCRYPTION_TENTACLE
119 #ifdef DEBUG_ENCRYPTION_TENTACLE
122 +
"; rejecting packet.");
131 if (decrypts_properly) {
138 #ifdef DEBUG_ENCRYPTION_TENTACLE
140 +
" due to erroneous decryption");
155 #ifdef DEBUG_ENCRYPTION_TENTACLE
156 LOG(
astring(
"client failed to process encrypted blowfish key for ")
170 if (worked !=
OKAY) {
171 #ifdef DEBUG_ENCRYPTION_TENTACLE
172 LOG(
astring(
"server failed to encrypt blowfish key for ")
void reset(int number=0, const contents *initial_contents=NULL_POINTER)
Resizes this array and sets the contents from an array of contents.
Provides a dynamically resizable ASCII character string.
A very common template for a dynamic array of bytes.
Outcomes describe the state of completion for an operation.
Provides BlowFish encryption on byte_arrays using the OpenSSL package.
bool decrypt(const basis::byte_array &source, basis::byte_array &target) const
decrypts the "target" array from the encrypted "source" array.
Supports public key encryption and decryption.
Encapsulates the chit-chat necessary to establish an encrypted connection.
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.
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.
virtual void expunge(const octopus_entity &to_remove)
throws out any keys we were maintaining for this entity.
key_repository & keys() const
provides access to our list of keys.
const crypto::rsa_crypto & private_key() const
provides access to the key held here.
virtual basis::outcome consume(infoton &to_chow, const octopus_request_id &item_id, basis::byte_array &transformed)
the base class handles the processing of the request in "to_chow".
encryption_tentacle()
this tentacle will implement the server side.
virtual ~encryption_tentacle()
virtual basis::outcome reconstitute(const structures::string_array &classifier, basis::byte_array &packed_form, infoton *&reformed)
recreates a "reformed" infoton from a packed form.
Wraps an encrypted infoton when the octopus is in an encrypted mode.
basis::byte_array _wrapped
the encrypted data that's held here.
An infoton is an individual request parcel with accompanying information.
void unlock(octenc_key_record *to_unlock)
drops the lock on the key record in "to_unlock".
basis::outcome add(const octopus_entity &ent, const crypto::blowfish_crypto &key)
adds a "key" for the "ent". this will fail if one is already listed.
octenc_key_record * lock(const octopus_entity &ent)
locates the key for "ent", if it's stored.
Tracks the keys that have been assigned for a secure channel.
crypto::blowfish_crypto _key
used for communicating with an entity.
Provides a way of identifying users of an octopus object.
basis::astring mangled_form() const
returns the combined string form of the identifier.
Identifies requests made on an octopus by users.
octopus_entity _entity
the entity.
provides prefab implementations for parts of the tentacle object.
bool store_product(infoton *product, const octopus_request_id &original_id)
used by tentacles to store the objects they produce from infotons.
@ PARTIAL
processing of request is partially done.
@ ENCRYPTION_MISMATCH
there is a disconnect regarding encryption.
@ NO_HANDLER
no handler for that type of infoton.
An array of strings with some additional helpful methods.
#define formal(parameter)
This macro just eats what it's passed; it marks unused formal parameters.
#define NULL_POINTER
The value representing a pointer to nothing.
#define FUNCDEF(func_in)
FUNCDEF sets the name of a function (and plugs it into the callstack).
The guards collection helps in testing preconditions and reporting errors.
void WHACK(contents *&ptr)
deletion with clearing of the pointer.
A logger that sends to the console screen using the standard output device.
basis::outcome reconstituter(const structures::string_array &classifier, basis::byte_array &packed_form, infoton *&reformed, contents *formal(junk))
< reconstituter should work for most infotons to restore flattened infotons.
A dynamic container class that holds any kind of object via pointers.