Simple Geolocalization and Course Transmission Protocol (SGCTP)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Pages
SGCTP::CPayload_AES128 Class Reference

AES128-encrypted SGCTP payload. More...

#include <sgctp/payload_aes128.hpp>

Inheritance diagram for SGCTP::CPayload_AES128:
SGCTP::CPayload

Public Member Functions

 CPayload_AES128 ()
 
virtual ~CPayload_AES128 ()
 
virtual int alloc ()
 Allocate resources for payload (un-)serialization. More...
 
virtual int serialize (unsigned char *_pucBuffer, const CData &_roData)
 Serialize the given SGCTP data into the given payload buffer. More...
 
virtual int unserialize (CData *_poData, const unsigned char *_pucBuffer, uint16_t _ui16tBufferSize)
 Unserialize the SGCTP data from the given payload buffer. More...
 
virtual void free ()
 Free resources for payload (un-)serialization. More...
 
int makeCryptoKey (const unsigned char *_pucPassword, int _iPasswordLength, const unsigned char *_pucNonce)
 Create cryptographic key (and seal) More...
 
int incrCryptoKey ()
 Increment cryptographic key (and seal) More...
 
- Public Member Functions inherited from SGCTP::CPayload
 CPayload ()
 
virtual ~CPayload ()
 

Static Public Member Functions

static int makeCryptoNonce (unsigned char *_pucNonce)
 Create cryptographic nonce. More...
 
- Static Public Member Functions inherited from SGCTP::CPayload
static unsigned char * allocBuffer ()
 Allocate a buffer for payload (un-)serialization. More...
 
static void zeroBuffer (unsigned char *_pucBuffer)
 Zero-out a buffer required for payload (un-)serialization. More...
 
static void freeBuffer (unsigned char *_pucBuffer)
 Free a buffer allocated for payload (un-)serialization. More...
 

Static Public Attributes

static const int CRYPTO_CIPHER = GCRY_CIPHER_AES128
 
static const int CRYPTO_MODE = GCRY_CIPHER_MODE_CBC
 
static const uint16_t CRYPTO_BLOCK_SIZE = 16
 
static const uint16_t CRYPTO_NONCE_SIZE = 16
 
static const uint16_t CRYPTO_KEY_SIZE = 16
 
static const uint16_t CRYPTO_KEY_ITER = 16384
 
static const uint16_t CRYPTO_SEAL_SIZE = 4
 
- Static Public Attributes inherited from SGCTP::CPayload
static const uint16_t BUFFER_SIZE = 33024
 Buffer size required for payload (un-)serialization. More...
 

Static Private Member Functions

static int initCryptoEngine ()
 Initialize cryptographic engine. More...
 

Private Attributes

unsigned char * pucBufferTmp
 Payload temporary import/export buffer. More...
 
unsigned char pucCryptoNonce [CRYPTO_NONCE_SIZE]
 Cryptographic nonce (used for cryptographic hashing) More...
 
unsigned char pucCryptoKey [CRYPTO_BLOCK_SIZE]
 Cryptographic key (used for encryption/decryption) More...
 
unsigned char pucCryptoSeal [CRYPTO_SEAL_SIZE]
 Cryptographic seal (used to check valid decryption) More...
 

Detailed Description

AES128-encrypted SGCTP payload.

This class (un-)serializes SGCTP data from/to an AES128-encrypted SGCTP payload.

Definition at line 48 of file payload_aes128.hpp.

Constructor & Destructor Documentation

CPayload_AES128::CPayload_AES128 ( )

Definition at line 107 of file payload_aes128.cpp.

CPayload_AES128::~CPayload_AES128 ( )
virtual

Definition at line 112 of file payload_aes128.cpp.

Member Function Documentation

int CPayload_AES128::makeCryptoNonce ( unsigned char *  _pucNonce)
static

Create cryptographic nonce.

Parameters
[in]_pucNonceNonce buffer (to store nonce into); it MUST have been allocated previously
Returns
Negative error code in case of error, zero otherwise
See Also
CRYPTO_NONCE_SIZE

Definition at line 71 of file payload_aes128.cpp.

int CPayload_AES128::initCryptoEngine ( )
staticprivate

Initialize cryptographic engine.

Returns
Negative error code in case of error, zero otherwise

Definition at line 87 of file payload_aes128.cpp.

int CPayload_AES128::alloc ( )
virtual

Allocate resources for payload (un-)serialization.

Returns
Negative error code in case of error, zero otherwise

Reimplemented from SGCTP::CPayload.

Definition at line 123 of file payload_aes128.cpp.

int CPayload_AES128::serialize ( unsigned char *  _pucBuffer,
const CData _roData 
)
virtual

Serialize the given SGCTP data into the given payload buffer.

Parameters
[in]_pucBufferPayload buffer (to write the serialization data to)
[in]_roDataSGCTP data object (to be serialized)
Returns
(Positive) Quantity of data actually serialized; Negative error code in case of error

Reimplemented from SGCTP::CPayload.

Definition at line 134 of file payload_aes128.cpp.

int CPayload_AES128::unserialize ( CData _poData,
const unsigned char *  _pucBuffer,
uint16_t  _ui16tBufferSize 
)
virtual

Unserialize the SGCTP data from the given payload buffer.

Parameters
[in]_poDataSGCTP data object (to store unserialized data)
[in]_pucBufferPayload buffer (to read the serialization data from)
Returns
(Positive) Quantity of data actually unserialized; Negative error code in case of error

Reimplemented from SGCTP::CPayload.

Definition at line 222 of file payload_aes128.cpp.

void CPayload_AES128::free ( )
virtual

Free resources for payload (un-)serialization.

Reimplemented from SGCTP::CPayload.

Definition at line 313 of file payload_aes128.cpp.

int CPayload_AES128::makeCryptoKey ( const unsigned char *  _pucPassword,
int  _iPasswordLength,
const unsigned char *  _pucNonce 
)

Create cryptographic key (and seal)

Parameters
[in]_pucPasswordUser password
[in]_iPasswordLengthUser password length
[in]_pucNonceNonce (salt) used for password hashing
Returns
Negative error code in case of error, zero otherwise
See Also
makeCryptoNonce()

Definition at line 325 of file payload_aes128.cpp.

int CPayload_AES128::incrCryptoKey ( )

Increment cryptographic key (and seal)

Returns
Negative error code in case of error, zero otherwise

Definition at line 375 of file payload_aes128.cpp.

Member Data Documentation

const int SGCTP::CPayload_AES128::CRYPTO_CIPHER = GCRY_CIPHER_AES128
static

Definition at line 59 of file payload_aes128.hpp.

const int SGCTP::CPayload_AES128::CRYPTO_MODE = GCRY_CIPHER_MODE_CBC
static

Definition at line 60 of file payload_aes128.hpp.

const uint16_t SGCTP::CPayload_AES128::CRYPTO_BLOCK_SIZE = 16
static

Definition at line 62 of file payload_aes128.hpp.

const uint16_t SGCTP::CPayload_AES128::CRYPTO_NONCE_SIZE = 16
static

Definition at line 63 of file payload_aes128.hpp.

const uint16_t SGCTP::CPayload_AES128::CRYPTO_KEY_SIZE = 16
static

Definition at line 64 of file payload_aes128.hpp.

const uint16_t SGCTP::CPayload_AES128::CRYPTO_KEY_ITER = 16384
static

Definition at line 65 of file payload_aes128.hpp.

const uint16_t SGCTP::CPayload_AES128::CRYPTO_SEAL_SIZE = 4
static

Definition at line 66 of file payload_aes128.hpp.

unsigned char* SGCTP::CPayload_AES128::pucBufferTmp
private

Payload temporary import/export buffer.

Definition at line 90 of file payload_aes128.hpp.

unsigned char SGCTP::CPayload_AES128::pucCryptoNonce[CRYPTO_NONCE_SIZE]
private

Cryptographic nonce (used for cryptographic hashing)

Definition at line 92 of file payload_aes128.hpp.

unsigned char SGCTP::CPayload_AES128::pucCryptoKey[CRYPTO_BLOCK_SIZE]
private

Cryptographic key (used for encryption/decryption)

Definition at line 94 of file payload_aes128.hpp.

unsigned char SGCTP::CPayload_AES128::pucCryptoSeal[CRYPTO_SEAL_SIZE]
private

Cryptographic seal (used to check valid decryption)

Definition at line 96 of file payload_aes128.hpp.


The documentation for this class was generated from the following files: