Bayonne2 / Common C++ 2 Framework
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
ZrtpConfigure Class Reference

ZRTP configuration data. More...

#include <ZrtpConfigure.h>

Collaboration diagram for ZrtpConfigure:
Collaboration graph
[legend]

Public Member Functions

 ZrtpConfigure ()
 
 ~ZrtpConfigure ()
 
void setStandardConfig ()
 Convenience function that sets a pre-defined standard configuration. More...
 
void setMandatoryOnly ()
 Convenience function that sets the mandatory algorithms only. More...
 
void clear ()
 Clear all configuration data. More...
 
int32_t addAlgo (AlgoTypes algoType, AlgorithmEnum &algo)
 Add an algorithm to configuration data. More...
 
int32_t addAlgoAt (AlgoTypes algoType, AlgorithmEnum &algo, int32_t index)
 Add an algorithm to configuration data at given index. More...
 
int32_t removeAlgo (AlgoTypes algoType, AlgorithmEnum &algo)
 Remove a algorithm from configuration data. More...
 
int32_t getNumConfiguredAlgos (AlgoTypes algoType)
 Returns the number of configured algorithms. More...
 
AlgorithmEnumgetAlgoAt (AlgoTypes algoType, int32_t index)
 Returns the identifier of the algorithm at index. More...
 
bool containsAlgo (AlgoTypes algoType, AlgorithmEnum &algo)
 Checks if the configuration data of the algorihm type already contains a specific algorithms. More...
 
void setTrustedMitM (bool yesNo)
 Enables or disables trusted MitM processing. More...
 
bool isTrustedMitM ()
 Check status of trusted MitM processing. More...
 
void setSasSignature (bool yesNo)
 Enables or disables SAS signature processing. More...
 
bool isSasSignature ()
 Check status of SAS signature processing. More...
 
void setParanoidMode (bool yesNo)
 Enables or disables paranoid mode. More...
 
bool isParanoidMode ()
 Check status of paranoid mode. More...
 
void printConfiguredAlgos (AlgoTypes algoTyp)
 Helper function to print some internal data. More...
 

Static Public Attributes

static const int maxNoOfAlgos = 7
 Set the maximum number of algorithms per algorithm type that an application can configure. More...
 

Private Member Functions

AlgorithmEnumgetAlgoAt (std::vector< AlgorithmEnum * > &a, int32_t index)
 
int32_t addAlgo (std::vector< AlgorithmEnum * > &a, AlgorithmEnum &algo)
 
int32_t addAlgoAt (std::vector< AlgorithmEnum * > &a, AlgorithmEnum &algo, int32_t index)
 
int32_t removeAlgo (std::vector< AlgorithmEnum * > &a, AlgorithmEnum &algo)
 
int32_t getNumConfiguredAlgos (std::vector< AlgorithmEnum * > &a)
 
bool containsAlgo (std::vector< AlgorithmEnum * > &a, AlgorithmEnum &algo)
 
std::vector< AlgorithmEnum * > & getEnum (AlgoTypes algoType)
 
void printConfiguredAlgos (std::vector< AlgorithmEnum * > &a)
 

Private Attributes

std::vector< AlgorithmEnum * > hashes
 
std::vector< AlgorithmEnum * > symCiphers
 
std::vector< AlgorithmEnum * > publicKeyAlgos
 
std::vector< AlgorithmEnum * > sasTypes
 
std::vector< AlgorithmEnum * > authLengths
 
bool enableTrustedMitM
 
bool enableSasSignature
 
bool enableParanoidMode
 

Detailed Description

ZRTP configuration data.

This class contains data and functions to set ZRTP configuration data. An application may use this class to set configuration information for ZRTP. ZRTP uses this configuration information to announce various algorithms via its Hello message. An application may use this class to restrict or allow use of algorithms.

The constructor does not set any algorithms, thus it is an empty configuration. An application may use this empty configuration and hand it over to ZRTP. In this case ZRTP does not announce any algorithms in its Hello message and uses mandatory algorithms only.

An application can configure implemented algorithms only.

Definition at line 312 of file ZrtpConfigure.h.

Constructor & Destructor Documentation

ZrtpConfigure::ZrtpConfigure ( )
ZrtpConfigure::~ZrtpConfigure ( )

Member Function Documentation

int32_t ZrtpConfigure::addAlgo ( AlgoTypes  algoType,
AlgorithmEnum algo 
)

Add an algorithm to configuration data.

Adds the specified algorithm to the configuration data. If no free configuration data slot is available the function does not add the algorithm and returns -1. The methods appends the algorithm to the existing algorithms.

Parameters
algoTypeSpecifies which algorithm type to select
algoThe enumeration of the algorithm to add.
Returns
Number of free configuration data slots or -1 on error
int32_t ZrtpConfigure::addAlgo ( std::vector< AlgorithmEnum * > &  a,
AlgorithmEnum algo 
)
private
int32_t ZrtpConfigure::addAlgoAt ( AlgoTypes  algoType,
AlgorithmEnum algo,
int32_t  index 
)

Add an algorithm to configuration data at given index.

Adds the specified algorithm to the configuration data vector at a given index. If the index is larger than the actual size of the configuration vector the method just appends the algorithm.

Parameters
algoTypeSpecifies which algorithm type to select
algoThe enumeration of the algorithm to add.
indexThe index where to add the algorihm
Returns
Number of free configuration data slots or -1 on error
int32_t ZrtpConfigure::addAlgoAt ( std::vector< AlgorithmEnum * > &  a,
AlgorithmEnum algo,
int32_t  index 
)
private
void ZrtpConfigure::clear ( )

Clear all configuration data.

The functions clears all configuration data.

bool ZrtpConfigure::containsAlgo ( AlgoTypes  algoType,
AlgorithmEnum algo 
)

Checks if the configuration data of the algorihm type already contains a specific algorithms.

Parameters
algoTypeSpecifies which algorithm type to select
algoThe algorithm to check
Returns
True if the algorithm was found, false otherwise.
bool ZrtpConfigure::containsAlgo ( std::vector< AlgorithmEnum * > &  a,
AlgorithmEnum algo 
)
private
AlgorithmEnum& ZrtpConfigure::getAlgoAt ( AlgoTypes  algoType,
int32_t  index 
)

Returns the identifier of the algorithm at index.

Parameters
algoTypeSpecifies which algorithm type to select
indexThe index in the list of the algorihm type
Returns
A pointer the the algorithm enumeration. If the index does not point to a configured slot then the function returns NULL.
AlgorithmEnum& ZrtpConfigure::getAlgoAt ( std::vector< AlgorithmEnum * > &  a,
int32_t  index 
)
private
std::vector<AlgorithmEnum* >& ZrtpConfigure::getEnum ( AlgoTypes  algoType)
private
int32_t ZrtpConfigure::getNumConfiguredAlgos ( AlgoTypes  algoType)

Returns the number of configured algorithms.

Parameters
algoTypeSpecifies which algorithm type to select
Returns
The number of configured algorithms (used configuration data slots)
int32_t ZrtpConfigure::getNumConfiguredAlgos ( std::vector< AlgorithmEnum * > &  a)
private
bool ZrtpConfigure::isParanoidMode ( )

Check status of paranoid mode.

Returns
Returns true if paranoid mode is enabled.
bool ZrtpConfigure::isSasSignature ( )

Check status of SAS signature processing.

Returns
Returns true if certificate processing is enabled.
bool ZrtpConfigure::isTrustedMitM ( )

Check status of trusted MitM processing.

Returns
Returns true if trusted MitM processing is enabled.
void ZrtpConfigure::printConfiguredAlgos ( AlgoTypes  algoTyp)

Helper function to print some internal data.

void ZrtpConfigure::printConfiguredAlgos ( std::vector< AlgorithmEnum * > &  a)
private
int32_t ZrtpConfigure::removeAlgo ( AlgoTypes  algoType,
AlgorithmEnum algo 
)

Remove a algorithm from configuration data.

Removes the specified algorithm from configuration data. If the algorithm was not configured previously the function does not modify the configuration data and returns the number of free configuration data slots.

If an application removes all algorithms then ZRTP does not include any algorithm into the hello message and falls back to a predefined mandatory algorithm.

Parameters
algoTypeSpecifies which algorithm type to select
algoThe enumeration of the algorithm to remove.
Returns
Number of free configuration slots.
int32_t ZrtpConfigure::removeAlgo ( std::vector< AlgorithmEnum * > &  a,
AlgorithmEnum algo 
)
private
void ZrtpConfigure::setMandatoryOnly ( )

Convenience function that sets the mandatory algorithms only.

Mandatory algorithms are:

  • Hash: SHA256
  • Symmetric Cipher: AES 128
  • Public Key Algorithm: DH3027, MultiStream
  • SAS type: libase 32
  • SRTP Authentication lengths: 32, 80
void ZrtpConfigure::setParanoidMode ( bool  yesNo)

Enables or disables paranoid mode.

For further explanation of paranoid mode refer to the documentation of ZRtp class.

Parameters
yesNoIf set to true then paranoid mode is enabled.
void ZrtpConfigure::setSasSignature ( bool  yesNo)

Enables or disables SAS signature processing.

For further details of trusted MitM processing refer to ZRTP specification, chapter 7.2

Parameters
yesNoIf set to true then certificate processing is enabled.
void ZrtpConfigure::setStandardConfig ( )

Convenience function that sets a pre-defined standard configuration.

The standard configuration consists of the following algorithms:

  • Hash: SHA256
  • Symmetric Cipher: AES 128, AES 256
  • Public Key Algorithm: DH2048, DH3027, MultiStream
  • SAS type: libase 32
  • SRTP Authentication lengths: 32, 80
void ZrtpConfigure::setTrustedMitM ( bool  yesNo)

Enables or disables trusted MitM processing.

For further details of trusted MitM processing refer to ZRTP specification, chapter 7.3

Parameters
yesNoIf set to true then trusted MitM processing is enabled.

Field Documentation

std::vector<AlgorithmEnum* > ZrtpConfigure::authLengths
private

Definition at line 518 of file ZrtpConfigure.h.

bool ZrtpConfigure::enableParanoidMode
private

Definition at line 522 of file ZrtpConfigure.h.

bool ZrtpConfigure::enableSasSignature
private

Definition at line 521 of file ZrtpConfigure.h.

bool ZrtpConfigure::enableTrustedMitM
private

Definition at line 520 of file ZrtpConfigure.h.

std::vector<AlgorithmEnum* > ZrtpConfigure::hashes
private

Definition at line 514 of file ZrtpConfigure.h.

const int ZrtpConfigure::maxNoOfAlgos = 7
static

Set the maximum number of algorithms per algorithm type that an application can configure.

Definition at line 321 of file ZrtpConfigure.h.

std::vector<AlgorithmEnum* > ZrtpConfigure::publicKeyAlgos
private

Definition at line 516 of file ZrtpConfigure.h.

std::vector<AlgorithmEnum* > ZrtpConfigure::sasTypes
private

Definition at line 517 of file ZrtpConfigure.h.

std::vector<AlgorithmEnum* > ZrtpConfigure::symCiphers
private

Definition at line 515 of file ZrtpConfigure.h.


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