Jeff is right, but triple-DES is still in the DLL, which is why DES_EDE2 
works.

----- Original Message ----- 
From: "Jeffrey Walton" <[EMAIL PROTECTED]>
To: "kumaresh" <[EMAIL PROTECTED]>
Cc: "Crypto++ Users" <[EMAIL PROTECTED]>
Sent: Friday, July 13, 2007 3:44 AM
Subject: Re: single Des encryption gives me linker errors


>
> Hi Kumaresh,
>
> The FIPS compliant Dll does not include the routine since NIST
> depricated it's use. IIRC, this includes 3DES also.
>
> Jeff
>
> On 7/13/07, kumaresh <[EMAIL PROTECTED]> wrote:
>>
>> Hello
>>
>> I am trying to perform single DES encryption using ECB mode. I have
>> attached a sample code here. This gives me a linker error.
>>
>> #include "stdafx.h"
>> #include "dll.h"
>> #include <iostream>
>> using namespace std;
>> using namespace CryptoPP;
>>
>> void singleDes()
>> {
>>        const unsigned int blockSize = 8;
>>
>>        unsigned char plainText[] = "Rtop34Wz";
>>
>>        unsigned char key[] = "Rtop34Wz";
>>
>>        unsigned char *cipherText;
>>
>>        cipherText = new unsigned char [blockSize];
>>
>>    unsigned char *DecText;
>>
>>    DecText = new unsigned char [blockSize];
>>
>>        ECB_Mode<DES>::Encryption ecbEncr;
>>
>>        ECB_Mode<DES>::Decryption ecbDecr;
>>
>>        ecbEncr.SetKey(key,8);
>>
>>        ecbEncr.ProcessData(cipherText,plainText,blockSize);
>>
>>        cout<<endl<<endl<<"Hex form of ciphertext password:- ";
>>
>>        for( int i = 0; i <8; i++ )
>>        {
>>                std::cout << std::hex << (0xFF & static_cast<byte>( 
>> cipherText[i]));
>>        }
>>
>>        ecbDecr.SetKey(key,8);
>>
>>        ecbDecr.ProcessData(DecText,cipherText,blockSize);
>>
>>        cout<<endl;
>>
>>        for(int i=0; i<8;i++)
>>        {
>>                cout<<DecText[i];
>>        }
>>
>>        /*for( int i = 0; i <8; i++ )
>>        {
>>                cout << std::hex << (0xFF & static_cast<byte>( 
>> cipherText[i]));
>>        }*/
>> }
>>
>> The error during compilation is:
>>
>> Linking...
>> singleDes.obj : error LNK2001: unresolved external symbol "public:
>> virtual void __thiscall
>> CryptoPP::DES::Base::ProcessAndXorBlock(unsigned char const *,unsigned
>> char const *,unsigned char *)const " (?
>> [EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED])
>> singleDes.obj : error LNK2001: unresolved external symbol "public:
>> virtual void __thiscall CryptoPP::DES::Base::UncheckedSetKey(unsigned
>> char const *,unsigned int,class CryptoPP::NameValuePairs const &)" (?
>> [EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@@Z)
>>
>> Whereas the following code works perfectly:
>>
>> #include "stdafx.h"
>> #include "dll.h"
>> #include <iostream>
>> using namespace std;
>> using namespace CryptoPP;
>>
>> void PasswordEncrypt()
>> {
>>    const unsigned int blocksize = 8;
>>
>>        byte password[] = "Rtop34Wz";//{'R','t','o','p','3','4','W','z'};
>>
>>        byte key[] = "Rtop34WzRtop34Wz";
>>
>>        byte iv[]= "00000000";
>>
>>        cout<<"Plain Text Password:- "<<password<<endl<<endl;
>>        cout<<"Hex form of plain text password:- ";
>>
>>        for( int i = 0; i <8; i++ )
>>          {
>>        std::cout << std::hex << (0xFF &
>> static_cast<byte>( password[i]));
>>          }
>>
>>        //declare vectors to hole encrypted and decrypted messages
>>    byte *ciphertext;
>>      ciphertext = new byte [blocksize];
>>      byte *decryptedtext;
>>      decryptedtext = new byte [blocksize];
>>
>>         // cout<<endl<<DES_EDE2::BLOCKSIZE;
>>
>>      //declare encryption and decryption objects
>>      CBC_Mode<DES_EDE2>::Encryption cbcencr;
>>          CBC_Mode<DES_EDE2>::Decryption cbcdec;
>>          cbcencr.SetKeyWithIV(key,strlen((char*)key),iv);
>>          cbcencr.ProcessData(ciphertext,password,DES_EDE2::BLOCKSIZE);
>>
>>          cout<<endl<<endl<<"Hex form of ciphertext password:- ";
>>          for( int i = 0; i <8; i++ )
>>          {
>>        std::cout << std::hex << (0xFF &
>> static_cast<byte>( ciphertext[i]));
>>          }
>>          cbcdec.SetKeyWithIV(key,strlen((char*)key),iv);
>> 
>> cbcdec.ProcessData(decryptedtext,ciphertext,DES_EDE2::BLOCKSIZE);
>>          cout<<endl<<endl<<"Decrypted Password:- ";
>>          for(int i=0; i<8;i++)
>>          {
>>                  cout<<decryptedtext[i];
>>          }
>>        //  cout<<endl<<"decryptedtext"<<endl<<decryptedtext;
>>          /*for( int i = 0; i <8; i++ )
>>          {
>>        std::cout << std::hex << (0xFF &
>> static_cast<byte>( decryptedtext[i]));
>>          }
>>    */
>> }
>>
>> Please suggest a solution to this problem.
>>
>> Note: I have already gone through every thing in
>> http://www.cryptopp.com/fom-serve/cache/1.html (The Crypto++ Faq-O-
>> Matic)
>>
>> -------
>> Thanks
>>
>> Kumaresh
>>
>>
>> >
>>
>
> > 



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [EMAIL PROTECTED]
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---

Reply via email to