Mobile API Reference  MicroStrategy 2019
MEncryptor Namespace Reference

Classes

class  BadDataException
 
class  BadDecryptionException
 
class  BadEncryptionException
 
class  BadHashException
 
class  EncryptorDecryptor
 EncryptorDecryptor takes a string or Data object and encrypts or decrypts. More...
 
class  Hash
 Hash is a one way encryption that uses RIPEMD160 hashing algorithm. More...
 
class  RIPEMD160EncryptorDecryptor
 RIPEMD160EncryptorDecryptor is one implementation of the EncryptorDecryptor interface. More...
 
class  RIPEMD160Hasher
 RIPEMD160Hasher exposes a static method to hash binary data. More...
 
class  WCharConverter
 

Typedefs

typedef MBase::StrongPtr< EncryptorDecryptorEncryptorDecryptorPtr
 

Enumerations

enum  EncryptionVersion { SIMPLE = -2, RC4 = -1, TEA = 0, AES = 1 }
 Encryption algorithm. For details, do a google search of RC4 and/or TEA. More...
 
enum  HashingVersion { RIPEMD160 = 0, HashingVersionHighest }
 

Functions

DLL_ENCRYPTOR_EXIM EncryptionVersion GetHighestVersionRIPEMD160 ()
 
DLL_ENCRYPTOR_EXIM EncryptionVersion GetHighestVersionMD5 ()
 
DLL_ENCRYPTOR_EXIM EncryptorDecryptorCreateRIPEMD160EncryptorDecryptor (const WCHAR *ipcKeySeed)
 RIPEMD160 KeySeed factory. More...
 
DLL_ENCRYPTOR_EXIM EncryptorDecryptorCreateRIPEMD160EncryptorDecryptor (MDataType::Binary *ipKey)
 RIPEMD160 KeySeed factory. More...
 
DLL_ENCRYPTOR_EXIM EncryptorDecryptorCreateMD5EncryptorDecryptor (const WCHAR *ipcKeySeed)
 MD5 KeySeed factory. More...
 
DLL_ENCRYPTOR_EXIM EncryptorDecryptorCreateSIMPLEEncryptorDecryptor ()
 Simple Encryptor/Decryptor factory. More...
 
DLL_ENCRYPTOR_EXIM EncryptorDecryptorCreatePDEncryptorDecryptor (const WCHAR *ipcKeySeed, EncryptionVersion &irEncryptionVersion)
 Platform Dependent (PD) Encryptor/Decryptor factory. More...
 
DLL_ENCRYPTOR_EXIM MBase::ReturnWString HexEncodeWithSignature (const MDataType::Binary *ipcData, unsigned Int32 inVersion, bool ibReverseHighLow=false, bool ibUpperCase=true)
 HexEncoder contains functions that perform conversion between binary data and its Hex representation. More...
 
DLL_ENCRYPTOR_EXIM MDataType::BinaryHexDecodeWithSignature (const WCHAR *ipcData, bool ibReverseHighLow=false)
 Decode the string encoded with HexEncodeWithSignature. More...
 
DLL_ENCRYPTOR_EXIM MBase::ReturnWString HexEncode (const MDataType::Binary *ipcData, bool ibReverseHighLow=false, bool ibUpperCase=true)
 Encode the given binary data into its Hex representation (without signature). More...
 
DLL_ENCRYPTOR_EXIM MDataType::BinaryHexDecode (const WCHAR *ipcData, bool ibReverseHighLow=false)
 Decode the string encoded with HexEncode. More...
 
DLL_ENCRYPTOR_EXIM unsigned Int32 GetVersion (const WCHAR *ipcEncodedData)
 Retrieve the version from the given encoded data (encoded with HexEncodeWithSignature) More...
 
DLL_ENCRYPTOR_EXIM MDataType::BinaryAddHeader (const MDataType::Binary *ipcData, unsigned Int32 inVersion)
 
DLL_ENCRYPTOR_EXIM MDataType::BinaryRemoveHeader (const MDataType::Binary *ipcData)
 
WCHARhHexEncodeWithEncryptionLevel (const MDataType::Binary *ipcData, unsigned int inEncryptionLevel, unsigned int inHashVersion, bool ibReverseHighLow=false, bool ibUpperCase=true)
 
MDataType::BinaryHexDecodeWithEncryptionLevel (const WCHAR *ipcData, bool ibReverseHighLow)
 
WCHARhHexEncodeWithSignature (const MDataType::Binary *ipcData, unsigned int inVersion, bool ibReverseHighLow=false, bool ibUpperCase=true)
 The actual implementation of the encoding algorithm. More...
 
bool ctoi (unsigned char iDigitChar, unsigned char &orDigit)
 Converts a character to a number. More...
 
WCHARhHexEncode (const MDataType::Binary *ipcBinaryData, bool ibReverseHighLow=false, bool ibUpperCase=true)
 Actually encode the given binary to its Hex representation. More...
 

Typedef Documentation

◆ EncryptorDecryptorPtr

Enumeration Type Documentation

◆ EncryptionVersion

Encryption algorithm. For details, do a google search of RC4 and/or TEA.

Enumerator
SIMPLE 
RC4 
TEA 
AES 

◆ HashingVersion

Enumerator
RIPEMD160 
HashingVersionHighest 

Function Documentation

◆ AddHeader()

DLL_ENCRYPTOR_EXIM MDataType::Binary* MEncryptor::AddHeader ( const MDataType::Binary ipcData,
unsigned Int32  inVersion 
)

◆ CreateMD5EncryptorDecryptor()

DLL_ENCRYPTOR_EXIM EncryptorDecryptor* MEncryptor::CreateMD5EncryptorDecryptor ( const WCHAR ipcKeySeed)

MD5 KeySeed factory.

ipcKeySeed is hashed into a key using MD5

◆ CreatePDEncryptorDecryptor()

DLL_ENCRYPTOR_EXIM EncryptorDecryptor* MEncryptor::CreatePDEncryptorDecryptor ( const WCHAR ipcKeySeed,
EncryptionVersion irEncryptionVersion 
)

Platform Dependent (PD) Encryptor/Decryptor factory.

Strong encryption algorithms (like RC4) is prohibited from some platforms. Franch is one of the platforms that we are aware of where RC4 is prohibited. As a result, a weak encryption algorithm is used in its place. But on all other platforms, we still use RC4. CreatePDEncryptorDecryptor is a factory to create an encryptor based on the locale ID. For those platforms where RC4 is prohibited, an SIMPLE encryptor is created. Otherwise, we create an RC4 encryptor (the key seed is hashed using MD5 hashing algorithm). The encryption version is carried out with parameter irEncryptionVersion.

ipcKeySeed is the key seed to create the strong encryptor irEncryptionVersion is a MEncryptor::EncryptionVersion.

◆ CreateRIPEMD160EncryptorDecryptor() [1/2]

DLL_ENCRYPTOR_EXIM EncryptorDecryptor* MEncryptor::CreateRIPEMD160EncryptorDecryptor ( const WCHAR ipcKeySeed)

RIPEMD160 KeySeed factory.

ipcKeySeed is hashed into a key using RIPEMD160

◆ CreateRIPEMD160EncryptorDecryptor() [2/2]

DLL_ENCRYPTOR_EXIM EncryptorDecryptor* MEncryptor::CreateRIPEMD160EncryptorDecryptor ( MDataType::Binary ipKey)

RIPEMD160 KeySeed factory.

ipcKeySeed is hashed into a key using RIPEMD160

◆ CreateSIMPLEEncryptorDecryptor()

DLL_ENCRYPTOR_EXIM EncryptorDecryptor* MEncryptor::CreateSIMPLEEncryptorDecryptor ( )

Simple Encryptor/Decryptor factory.

◆ ctoi()

bool MEncryptor::ctoi ( unsigned char  iDigitChar,
unsigned char &  orDigit 
)

Converts a character to a number.

◆ GetHighestVersionMD5()

DLL_ENCRYPTOR_EXIM EncryptionVersion MEncryptor::GetHighestVersionMD5 ( )

Retrieve the highest encryption/decryption algorithm version for the encryptor/decryptor that uses MD5 to hash keys. The intended use is when the encryptor and the decryptor may have different versions. The decryptor can get the highest level of encyption it supports and relay that information to the encryptor. The encryptor can then down grade and encrypt the message the decryptor can decrypt.

◆ GetHighestVersionRIPEMD160()

DLL_ENCRYPTOR_EXIM EncryptionVersion MEncryptor::GetHighestVersionRIPEMD160 ( )

Retrieve the highest encryption/decryption algorithm version for the encryptor/decryptor that uses RIPEMD160 to hash keys. The intended use is when the encryptor and the decryptor may have different versions. The decryptor can get the highest level of encyption it supports and relay that information to the encryptor. The encryptor can then down grade and encrypt the message the decryptor can decrypt.

◆ GetVersion()

DLL_ENCRYPTOR_EXIM unsigned Int32 MEncryptor::GetVersion ( const WCHAR ipcEncodedData)

Retrieve the version from the given encoded data (encoded with HexEncodeWithSignature)

Parameters
ipcEncodedDataThe encoded data
Returns
The version associated with the data. It returns -2 if the data is corrupted.

◆ HexDecode()

DLL_ENCRYPTOR_EXIM MDataType::Binary* MEncryptor::HexDecode ( const WCHAR ipcData,
bool  ibReverseHighLow = false 
)

Decode the string encoded with HexEncode.

Parameters
ipcDatais the string to be decoded
ibReverseHighLowindicates if the high and low part of a byte has been reversed (default is not).
Returns
The decoded data in binary format.
Exceptions
BadDataExceptionindicating the data is corrupted

◆ HexDecodeWithEncryptionLevel()

MDataType::Binary* MEncryptor::HexDecodeWithEncryptionLevel ( const WCHAR ipcData,
bool  ibReverseHighLow 
)

◆ HexDecodeWithSignature()

DLL_ENCRYPTOR_EXIM MDataType::Binary* MEncryptor::HexDecodeWithSignature ( const WCHAR ipcData,
bool  ibReverseHighLow = false 
)

Decode the string encoded with HexEncodeWithSignature.

Parameters
ipcDatais the encoded data
ibReverseHighLowindicates if the high and low part of a byte has been reversed (default is not).
Returns
The decoded data in binary format.
Exceptions
BadDataExceptionindicating the data is corrupted

◆ HexEncode()

DLL_ENCRYPTOR_EXIM MBase::ReturnWString MEncryptor::HexEncode ( const MDataType::Binary ipcData,
bool  ibReverseHighLow = false,
bool  ibUpperCase = true 
)

Encode the given binary data into its Hex representation (without signature).

Parameters
ipcDatais the binary data to be encoded
ibReverseHighLowindicates if the high and low part of a byte needs to be reversed (default is not).
ibUpperCaseindicates whether to use upper case for the hexdecimal letters (default is upper case).
Returns
Hex representation of the binary data

◆ HexEncodeWithSignature()

DLL_ENCRYPTOR_EXIM MBase::ReturnWString MEncryptor::HexEncodeWithSignature ( const MDataType::Binary ipcData,
unsigned Int32  inVersion,
bool  ibReverseHighLow = false,
bool  ibUpperCase = true 
)

HexEncoder contains functions that perform conversion between binary data and its Hex representation.

Encode the given binary data into its Hex representation. It also hash the binary data to generate a signature. You can also associate a version with the encoded data. The encoded data contains the version, the signature and the original data (in this order).

Parameters
ipcDatais the binary data to be encoded
inVersionis the version that you'd like to associate with the data
ibReverseHighLowindicates if the high and low part of a byte needs to be reversed (default is not).
ibUpperCaseindicates whether to use upper case for the hexdecimal letters (default is upper case).
Returns
Hex representation of the binary data, it contains the version, a signature and the data (in this order)

◆ hHexEncode()

WCHAR* MEncryptor::hHexEncode ( const MDataType::Binary ipcBinaryData,
bool  ibReverseHighLow = false,
bool  ibUpperCase = true 
)

Actually encode the given binary to its Hex representation.

◆ hHexEncodeWithEncryptionLevel()

WCHAR* MEncryptor::hHexEncodeWithEncryptionLevel ( const MDataType::Binary ipcData,
unsigned int  inEncryptionLevel,
unsigned int  inHashVersion,
bool  ibReverseHighLow = false,
bool  ibUpperCase = true 
)

◆ hHexEncodeWithSignature()

WCHAR* MEncryptor::hHexEncodeWithSignature ( const MDataType::Binary ipcData,
unsigned int  inVersion,
bool  ibReverseHighLow = false,
bool  ibUpperCase = true 
)

The actual implementation of the encoding algorithm.

◆ RemoveHeader()

DLL_ENCRYPTOR_EXIM MDataType::Binary* MEncryptor::RemoveHeader ( const MDataType::Binary ipcData)