DUKPT isn't exactly a well defined acronym. You could be using any of a wide host of algorithms. Do you mean ANSI X9.24? If so I think all of the base routines are there. You will have to plug them together to get X9.24 behavior.

        73,
                Shawn

Tim Droz wrote:

Yeah this sample is great,for a newby this kind of
sample / documentation would be nice.

I'm trying to do DUKPT simulation with crypto++ I'm
not sure of this library and its applicability.
Any more help would be really appreciated.


Thanks again David Tim

--- "David C. Partridge" <[EMAIL PROTECTED]>
wrote:

Do you mean like:
#include "default.h"
#include "des.h"

#include <iostream>
#include <time.h>

#include <windows.h>

#if (_MSC_VER >= 1000)
#include <crtdbg.h>               // for the debug heap
#endif

USING_NAMESPACE(CryptoPP)
USING_NAMESPACE(std)


int main() { // Note the for ECB, the PlainText and Cipher Text MUST be an EXACT multiple // of the cipher blocksize byte plaintext[48] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'}; byte * ciphertext; byte * result; byte key[DES::DEFAULT_KEYLENGTH];

       // initialize key and iv here
       memcpy(key, "12345678", sizeof(key));


// encrypt ECB_Mode<DES>::Encryption ecbEncryption; ecbEncryption.SetKey(key, ecbEncryption.DefaultKeyLength()); StreamTransformationFilter encryptor(ecbEncryption, NULL, NULL); encryptor.Put(plaintext, sizeof(plaintext)); encryptor.MessageEnd();

       unsigned int outputLength =
encryptor.MaxRetrievable();
       ciphertext = new byte[outputLength];
       encryptor.Get(ciphertext, outputLength);

       // now decrypt
       ECB_Mode<DES>::Decryption ecbDecryption;
       ecbDecryption.SetKey(key,
ecbDecryption.DefaultKeyLength());
       StreamTransformationFilter
decryptor(ecbDecryption, NULL, NULL);
       decryptor.Put(ciphertext, outputLength);
       decryptor.MessageEnd();

       outputLength = decryptor.MaxRetrievable();
       result = new byte[outputLength];
       decryptor.Get(result, outputLength);

       cout << "recovered plaintext is " << result
<< endl;

       delete [] ciphertext;
       delete [] result;
       return 0;
}





__________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com





Reply via email to