![]() |
PIP 5.6.1
Platform-Independent Primitives
|
Base helper that adds optional packet encryption to transport utilities. More...
#include <piethutilbase.h>

Public Member Functions | |
| PIEthUtilBase () | |
| Constructs helper with crypt layer disabled. | |
| ~PIEthUtilBase () | |
| Destroys the crypt helper. | |
| void | setCryptEnabled (bool on) |
| Enables or disables the crypt layer. | |
| void | cryptEnable () |
| Enables the crypt layer. | |
| void | cryptDisable () |
| Disables the crypt layer. | |
| bool | isCryptEnabled () const |
| Returns whether the crypt layer is enabled. | |
| void | setCryptKey (const PIByteArray &k) |
| Sets crypt key "k" and enables the crypt layer. | |
| void | createCryptKey (const PIString &k) |
| Generates crypt key from passphrase "k" and enables the crypt layer. | |
| PIByteArray | cryptKey () const |
| Returns current crypt key. | |
Static Public Member Functions | |
| static size_t | cryptSizeAddition () |
| Returns extra size added by encryption. | |
Protected Member Functions | |
| PIByteArray | cryptData (const PIByteArray &data) |
| Encrypts "data" when the crypt layer is enabled. | |
| PIByteArray | decryptData (const PIByteArray &data) |
| Decrypts "data" when the crypt layer is enabled. More... | |
Base helper that adds optional packet encryption to transport utilities.
Base class for ethernet utils.
PIEthUtilBase provides crypt layer for derived classes: PIStreamPacker and PIBroadcast. All input and output (sended and received) data can be decrypted/encrypted by this layer.
By default crypt layer is disabled.
You can separetely enable it and set ready-to-use key by setCryptEnabled() and setCryptKey(). Or you can use createCryptKey() to generate key from your passphrase and automatic enable crypt layer.
You can use this class as base for your own classes. Use cryptData() and decryptData() when send and receive your data.
|
protected |
Decrypts "data" when the crypt layer is enabled.
Returns decrypted data if layer enabled, otherwise returns unchanged "data". If decryption was unsuccessful returns empty PIByteArray