C12Adapter Opensource C++ Interface
MDes Class Reference

DES encryption and decryption class. More...

Inheritance diagram for MDes:

Static Public Member Functions

static MByteString StaticEncrypt (const MByteString &key, const MByteString &plainText)
 Static method for encrypting the 64-bit byte string. More...
 
static MByteString StaticDecrypt (const MByteString &key, const MByteString &cipherText)
 Static method for encrypting the 64-bit byte string. More...
 
static void StaticEncryptBuffer (const char *key, const char *plainText, char *cipherText, unsigned size=8)
 Static method for encrypting the 64-bit byte buffer in ECB mode. More...
 
static void StaticDecryptBuffer (const char *key, const char *cipherText, char *plainText, unsigned size=8)
 Static method for decrypting the 64-bit byte buffer. More...
 
- Static Public Member Functions inherited from MObject
static const MClassGetStaticClass ()
 Get the declared class of this particular object. More...
 
static bool IsClassPresent (const MStdString &name)
 Tells if the given class name is available. More...
 

Additional Inherited Members

- Public Member Functions inherited from MObject
virtual ~MObject ()
 Object destructor.
 
virtual const MClassGetClass () const =0
 Get the final class of the object. More...
 
virtual unsigned GetEmbeddedSizeof () const
 For embedded object types, return the size of the class. More...
 
bool IsEmbeddedObject () const
 Tell if the object is of embedded kind. More...
 
SHOW_INTERNAL MVariant Call (const MStdString &name, const MVariant &params)
 Call the object service with parameters, given as variant. More...
 
MVariant Call0 (const MStdString &name)
 Call the object service with no parameters. More...
 
MVariant Call1 (const MStdString &name, const MVariant &p1)
 Call the object service with one parameter. More...
 
MVariant Call2 (const MStdString &name, const MVariant &p1, const MVariant &p2)
 Call the object service with two parameter. More...
 
MVariant Call3 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3)
 Call the object service with three parameter. More...
 
MVariant Call4 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4)
 Call the object service with four parameter. More...
 
MVariant Call5 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4, const MVariant &p5)
 Call the object service with five parameter. More...
 
MVariant Call6 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4, const MVariant &p5, const MVariant &p6)
 Call the object service with six parameter. More...
 
virtual MVariant CallV (const MStdString &name, const MVariant::VariantVector &params)
 Call the object service with parameters, given as variant vector. More...
 
virtual bool IsPropertyPresent (const MStdString &name) const
 Tell if the property with the given name exists.
 
virtual bool IsServicePresent (const MStdString &name) const
 Tell if the service with the given name exists.
 
virtual MVariant GetProperty (const MStdString &name) const
 Get the property value using name of the property. More...
 
virtual void SetProperty (const MStdString &name, const MVariant &value)
 Set the property using name of the property, and value. More...
 
virtual MStdStringVector GetAllPropertyNames () const
 Return the list of publicly available properties, persistent or not. More...
 
virtual MStdStringVector GetAllPersistentPropertyNames () const
 Return the list of persistent properties. More...
 
virtual void SetPersistentPropertiesToDefault ()
 Set the persistent properties of the object to their default values. More...
 
virtual MVariant GetPersistentPropertyDefaultValue (const MStdString &name) const
 Get the default value of persistent property with the name given. More...
 
virtual void SetPersistentPropertyToDefault (const MStdString &name)
 Set the persistent property with the name given to default value. More...
 
virtual const char * GetType () const
 Get the name of the type for the object (could be the same as class name).
 
virtual void SetType (const MStdString &)
 Intentionally, it will set the name of the type for the object, but the service will not allow setting the name to anything other than the current name. More...
 
virtual void Validate ()
 Validate internal structures of the object. More...
 
- Static Public Attributes inherited from MObject
static const MClass s_class
 Class of MObject.
 
- Protected Member Functions inherited from MObject
 MObject ()
 Object constructor, protected as the class is abstract.
 
void DoSetPersistentPropertiesToDefault (const MClass *staticClass)
 Set the persistent properties to their default values for one object provided the class for that object. More...
 

Detailed Description

DES encryption and decryption class.

Only 56-bit DES is supported, 64-bit key and data size. By contemporary standards, pure DES is insecure, and should not be used in new code.

Member Function Documentation

static MByteString MDes::StaticDecrypt ( const MByteString key,
const MByteString cipherText 
)
static

Static method for encrypting the 64-bit byte string.

Parameters
keyShall be exactly 8 bytes, binary. Only 56 bits out of 64 are used, the lower bit of every byte is ignored. Notice, the difference from all other MeteringSDK classes is that Key of MDes is binary, not a hex string.
cipherTextRaw bytes of size, exactly 8 bytes.
Returns
MByteString - result plain text, 8 bytes.
See also
StaticEncrypt - encryption method
static void MDes::StaticDecryptBuffer ( const char *  key,
const char *  cipherText,
char *  plainText,
unsigned  size = 8 
)
static

Static method for decrypting the 64-bit byte buffer.

ECB mode is inherently insecure, just as DES with 56-bit key

Parameters
keyShall be exactly 8 bytes, binary. Only 56 bits out of 64 are used, the lower bit of every byte is ignored. Notice, the difference from all other MeteringSDK classes is that Key of MDes is binary, not a hex string.
cipherTextRaw bytes of size, divisible by 8 bytes.
plainTextRaw bytes of size, divisible by 8 bytes.
sizeSize if plain and cipher texts in bytes, divisible by 8 bytes.
See also
StaticEncryptBuffer - encryption method
static MByteString MDes::StaticEncrypt ( const MByteString key,
const MByteString plainText 
)
static

Static method for encrypting the 64-bit byte string.

Parameters
keyShall be exactly 8 bytes, binary. Only 56 bits out of 64 are used, the lower bit of every byte is ignored. Notice, the difference from all other MeteringSDK classes is that Key of MDes is binary, not a hex string.
plainTextRaw bytes of size, exactly 8 bytes.
Returns
MByteString - result cipher text, 8 bytes.
See also
StaticDecrypt - decryption method
static void MDes::StaticEncryptBuffer ( const char *  key,
const char *  plainText,
char *  cipherText,
unsigned  size = 8 
)
static

Static method for encrypting the 64-bit byte buffer in ECB mode.

ECB mode is inherently insecure, just as DES with 56-bit key

Parameters
keyShall be exactly 8 bytes, binary. Only 56 bits out of 64 are used, the lower bit of every byte is ignored. Notice, the difference from all other MeteringSDK classes is that Key of MDes is binary, not a hex string.
plainTextRaw bytes of size, divisible by 8 bytes.
cipherTextResult cipher text, divisible by 8 bytes.
sizeSize if plain and cipher texts in bytes, divisible by 8 bytes.
See also
StaticDecryptBuffer - decryption method