Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

dsDES Class Reference

#include <dsDES.h>

Inheritance diagram for dsDES:

dsBlockCypher dsCypher dsCryptoBase List of all members.

Public Types

enum  keyMode {
  kmNONE = 0, kmENCRYPT = 0x2, kmDECRYPT = 0x4, kmOFB = kmENCRYPT,
  kmBOTH = kmENCRYPT | kmDECRYPT
}

Public Methods

virtual void setKey (const dsCypher_byte_t *p_key, dsCypher_word32_t p_keyLen, keyMode km=dsCypher::kmBOTH) dsCypher_SECTION
virtual void encryptBlock (const dsCypher_word32_t *inBlock, dsCypher_word32_t *outBlock) dsCypher_SECTION
virtual void decryptBlock (const dsCypher_word32_t *inBlock, dsCypher_word32_t *outBlock) dsCypher_SECTION
 dsDES (const dsCypher_byte_t *p_key, dsCypher_word32_t p_keyLen)
 dsDES ()
virtual void ecbEncrypt (dsCypher_byte_t *p_dest, const dsCypher_byte_t *p_src, dsCypher_word32_t p_srcLen)
virtual void ecbDecrypt (dsCypher_byte_t *p_dest, const dsCypher_byte_t *p_src, dsCypher_word32_t p_srcLen)
virtual void cbcEncrypt (dsCypher_byte_t *p_dest, const dsCypher_byte_t *p_src, dsCypher_word32_t p_srcLen, const dsCypher_byte_t *iv)
virtual void cbcDecrypt (dsCypher_byte_t *p_dest, const dsCypher_byte_t *p_src, dsCypher_word32_t p_srcLen, const dsCypher_byte_t *iv)
virtual void ofbXOR (dsCypher_byte_t *p_dest, const dsCypher_byte_t *p_src, dsCypher_word32_t p_srcLen, const dsCypher_byte_t *iv)
virtual void ofbXOR (std::ostream &p_dest, std::istream &p_src, const dsCypher_byte_t *ivec)
bool ready ()

Public Attributes

keyMode _active_key_mode

Protected Methods

void memSet (dsCypher_byte_t *ptr, dsCypher_byte_t pattern, dsCypher_word32_t size)
void memCopy (dsCypher_byte_t *dest, const dsCypher_byte_t *src, dsCypher_word32_t size)
dsCypher_word32_t n2l (const dsCypher_byte_t *c)
dsCypher_word32_t n2le (const dsCypher_byte_t *c)
void l2n (dsCypher_word32_t l, dsCypher_byte_t *c)
void l2ne (dsCypher_word32_t l, dsCypher_byte_t *c)
void n_n2l (dsCypher_word32_t *dest, const dsCypher_byte_t *src, dsCypher_word32_t srcLen)
void n_n2le (dsCypher_word32_t *dest, const dsCypher_byte_t *src, dsCypher_word32_t srcLen)
void n_l2n (dsCypher_byte_t *dest, const dsCypher_word32_t *src, dsCypher_word32_t srcLen)
void n_l2ne (dsCypher_byte_t *dest, const dsCypher_word32_t *src, dsCypher_word32_t srcLen)
void n_xor (dsCypher_word32_t *dest, const dsCypher_word32_t *src, dsCypher_word32_t size)
dsCypher_word32_t rotl (dsCypher_word32_t x, dsCypher_word32_t n)
dsCypher_word32_t rotr (dsCypher_word32_t x, dsCypher_word32_t n)

Protected Attributes

dsCypher_word32_t _block_size

Detailed Description

This class is implementation of DES and 3DES.

DES/3DES algorithm is slow and unsecure, and should be replased by AES or other cypher whenever it possible.

This code based on:

FIPS-46-3 compliant 3DES implementation Copyright (C) 2001-2003 Christophe Devine


Member Enumeration Documentation

enum dsCypher::keyMode [inherited]
 

Enumeration values:
kmNONE 
kmENCRYPT 
kmDECRYPT 
kmOFB 
kmBOTH 


Constructor & Destructor Documentation

dsDES::dsDES const dsCypher_byte_t   p_key,
dsCypher_word32_t    p_keyLen
 

dsDES::dsDES  
 


Member Function Documentation

virtual void dsBlockCypher::cbcDecrypt dsCypher_byte_t   p_dest,
const dsCypher_byte_t   p_src,
dsCypher_word32_t    p_srcLen,
const dsCypher_byte_t   iv
[virtual, inherited]
 

virtual void dsBlockCypher::cbcEncrypt dsCypher_byte_t   p_dest,
const dsCypher_byte_t   p_src,
dsCypher_word32_t    p_srcLen,
const dsCypher_byte_t   iv
[virtual, inherited]
 

Perform CBC encryption/decryption

virtual void dsDES::decryptBlock const dsCypher_word32_t   inBlock,
dsCypher_word32_t   outBlock
[virtual]
 

Implements dsBlockCypher.

virtual void dsBlockCypher::ecbDecrypt dsCypher_byte_t   p_dest,
const dsCypher_byte_t   p_src,
dsCypher_word32_t    p_srcLen
[virtual, inherited]
 

virtual void dsBlockCypher::ecbEncrypt dsCypher_byte_t   p_dest,
const dsCypher_byte_t   p_src,
dsCypher_word32_t    p_srcLen
[virtual, inherited]
 

Perform ECB encryption/decryption

virtual void dsDES::encryptBlock const dsCypher_word32_t   inBlock,
dsCypher_word32_t   outBlock
[virtual]
 

Basic encryption/decryption

Implements dsBlockCypher.

void dsCryptoBase::l2n dsCypher_word32_t    l,
dsCypher_byte_t   c
[inline, protected, inherited]
 

void dsCryptoBase::l2ne dsCypher_word32_t    l,
dsCypher_byte_t   c
[inline, protected, inherited]
 

void dsCryptoBase::memCopy dsCypher_byte_t   dest,
const dsCypher_byte_t   src,
dsCypher_word32_t    size
[inline, protected, inherited]
 

void dsCryptoBase::memSet dsCypher_byte_t   ptr,
dsCypher_byte_t    pattern,
dsCypher_word32_t    size
[inline, protected, inherited]
 

These routines placed here to allow developer to providei os specific implementation, it's not virtual because calling virtual function inside encryption algorithm dramatically decrease performance

dsCypher_word32_t dsCryptoBase::n2l const dsCypher_byte_t   c [inline, protected, inherited]
 

Byte sequence to Word32 and back conversion routines

dsCypher_word32_t dsCryptoBase::n2le const dsCypher_byte_t   c [inline, protected, inherited]
 

void dsCryptoBase::n_l2n dsCypher_byte_t   dest,
const dsCypher_word32_t   src,
dsCypher_word32_t    srcLen
[inline, protected, inherited]
 

void dsCryptoBase::n_l2ne dsCypher_byte_t   dest,
const dsCypher_word32_t   src,
dsCypher_word32_t    srcLen
[inline, protected, inherited]
 

void dsCryptoBase::n_n2l dsCypher_word32_t   dest,
const dsCypher_byte_t   src,
dsCypher_word32_t    srcLen
[inline, protected, inherited]
 

void dsCryptoBase::n_n2le dsCypher_word32_t   dest,
const dsCypher_byte_t   src,
dsCypher_word32_t    srcLen
[inline, protected, inherited]
 

void dsCryptoBase::n_xor dsCypher_word32_t   dest,
const dsCypher_word32_t   src,
dsCypher_word32_t    size
[inline, protected, inherited]
 

virtual void dsBlockCypher::ofbXOR std::ostream &    p_dest,
std::istream &    p_src,
const dsCypher_byte_t   ivec
[virtual, inherited]
 

C++ stream interfaces

virtual void dsBlockCypher::ofbXOR dsCypher_byte_t   p_dest,
const dsCypher_byte_t   p_src,
dsCypher_word32_t    p_srcLen,
const dsCypher_byte_t   iv
[virtual, inherited]
 

Perform stream encryption/decryption (OFB)

bool dsCypher::ready   [inline, inherited]
 

dsCypher_word32_t dsCryptoBase::rotl dsCypher_word32_t    x,
dsCypher_word32_t    n
[inline, protected, inherited]
 

dsCypher_word32_t dsCryptoBase::rotr dsCypher_word32_t    x,
dsCypher_word32_t    n
[inline, protected, inherited]
 

virtual void dsDES::setKey const dsCypher_byte_t   p_key,
dsCypher_word32_t    p_keyLen,
keyMode    km = dsCypher::kmBOTH
[virtual]
 

Set key. Warning! It calls Encrypt 256 times, so don't use it too often

Implements dsCypher.


Member Data Documentation

keyMode dsCypher::_active_key_mode [inherited]
 

dsCypher_word32_t dsCypher::_block_size [protected, inherited]
 


The documentation for this class was generated from the following file:
Generated on Mon May 16 18:26:59 2005 for libdms4 by doxygen1.3-rc2