1 #ifndef ENCRYPTION_WRAPPER_CLASS
2 #define ENCRYPTION_WRAPPER_CLASS
4 /*****************************************************************************\
6 * Name : encryption_wrapper *
7 * Author : Chris Koeritz *
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 \*****************************************************************************/
18 #include <octopus/entity_defs.h>
19 #include <octopus/infoton.h>
20 #include <octopus/tentacle_helper.h>
24 //! Wraps an encrypted infoton when the octopus is in an encrypted mode.
26 The enclosed package will be unwrapped by the encryption tentacle.
29 class encryption_wrapper : public infoton
32 basis::byte_array _wrapped;
33 //!< the encrypted data that's held here.
34 /*!< this must be a packed classifier string array followed by
35 the packed infoton. */
37 encryption_wrapper(const basis::byte_array &wrapped = basis::byte_array::empty_array());
39 encryption_wrapper(const encryption_wrapper &to_copy);
41 virtual ~encryption_wrapper();
43 DEFINE_CLASS_NAME("encryption_wrapper");
45 encryption_wrapper &operator =(const encryption_wrapper &to_copy);
47 void text_form(basis::base_string &fill) const {
48 fill.assign(basis::astring(class_name())); // low exposure for vital held info.
51 static const structures::string_array &encryption_classifier();
52 //!< returns the classifier for this type of infoton.
54 virtual void pack(basis::byte_array &packed_form) const;
55 virtual bool unpack(basis::byte_array &packed_form);
57 virtual clonable *clone() const;
59 virtual int packed_size() const;
64 //! this simple tentacle just unpacks the encryption_wrapper infoton.
66 this object should never be doing more than that.
69 class unwrapping_tentacle
70 : public tentacle_helper<encryption_wrapper>
73 unwrapping_tentacle();
74 virtual ~unwrapping_tentacle();
76 DEFINE_CLASS_NAME("unwrapping_tentacle");
78 virtual basis::outcome reconstitute(const structures::string_array &classifier,
79 basis::byte_array &packed_form, infoton * &reformed);
81 virtual basis::outcome consume(infoton &to_chow, const octopus_request_id &item_id,
82 basis::byte_array &transformed);
83 //!< this should never be called.
88 #endif // outer guard.