Subject | Crypto Code |
---|---|
Author | Jim Starkey |
Post date | 2005-04-08T17:06:11Z |
It occurred to me that a better model is a system of simple
transformations, each inheriting from the abstract class
class Transform
{
public:
virtual int get (int bufferLength, UCHAR *buffer) = 0;
virtual int getLength() = 0;
};
where getLength() returns a good faith upper bound on the number of
bytes remains and get() fetches a hunk of data. Among the transform
classes are:
* StringTransform -- serves out data from a pre-existing byte array
* FileTransform -- fetches data from a file
* HexTransform -- encodes/decodes data between binary and ascii hex
* Base64Transform -- encodes/decodes data between binary and base 64
* RSATransform-- encodes/decodes data using public/private key
* DESTransform
* SHA1Transform
And so on. Each transformation is independent. Transform do
encryption, decryption, hashing, and work as input sources to BER decoding.
At the moment I'm disinclined to make key specification part of the
abstract Transform class, but I expect each of the primitive
encryption/decryption classes with use the transform machanism to import
keys.
--
Jim Starkey
Netfrastructure, Inc.
978 526-1376
transformations, each inheriting from the abstract class
class Transform
{
public:
virtual int get (int bufferLength, UCHAR *buffer) = 0;
virtual int getLength() = 0;
};
where getLength() returns a good faith upper bound on the number of
bytes remains and get() fetches a hunk of data. Among the transform
classes are:
* StringTransform -- serves out data from a pre-existing byte array
* FileTransform -- fetches data from a file
* HexTransform -- encodes/decodes data between binary and ascii hex
* Base64Transform -- encodes/decodes data between binary and base 64
* RSATransform-- encodes/decodes data using public/private key
* DESTransform
* SHA1Transform
And so on. Each transformation is independent. Transform do
encryption, decryption, hashing, and work as input sources to BER decoding.
At the moment I'm disinclined to make key specification part of the
abstract Transform class, but I expect each of the primitive
encryption/decryption classes with use the transform machanism to import
keys.
--
Jim Starkey
Netfrastructure, Inc.
978 526-1376