I posted a sample application a few weeks ago that does this.
http://www.escribe.com/software/crypto/index.html?by=Thread
Don Bergstrom
"Vincent Richomme
@Tricubes" To: <[EMAIL PROTECTED]>
<tricubes cc:
Subject: Re: CBC_mode : abnormal
termination
10/17/2003 04:49
AM
Please respond to
cryptopp-list
Do u have any sample code ?
juste a fesw lines ?
Regards
----- Original Message -----
From: "Peter Bell" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 17, 2003 5:40 AM
Subject: Re: CBC_mode : abnormal termination
> Keys for DES need to be preprocessed to have the parity bits set
> correctly, you code does no do this.
>
> Peter.
>
> > "Vincent Richomme @Tricubes" wrote:
> >
> > I am trying to use the CBC_mode but I always have this error :
> >
> > RunTime Error : abnormal program termination
> >
> > Here is the code i am using :
> >
> > byte key[DES::DEFAULT_KEYLENGTH];
> > memcpy(key, "12345678", sizeof(key));
> > CBC_Mode<DES>::Encryption ecbEncryption;
> > ecbEncryption.SetKey(key, ecbEncryption.DefaultKeyLength());
> >
> > I don't understand because when I use the ECB_mode it works :
> >
> > // 3DES in Electronic CodeBook mode(ECB) with Key (m_Key) and RN
> > (m_RN)
> > unsigned int outputLength;
> > ECB_Mode<DES_EDE2>::Encryption ecbEncryptionL;
> > ecbEncryptionL.SetKey(m_Key, ecbEncryptionL.DefaultKeyLength() );
> > StreamTransformationFilter encryptorL(ecbEncryptionL, NULL,
> > StreamTransformationFilter::ZEROS_PADDING);
> > encryptorL.Put(m_nRN, 8);
> > encryptorL.MessageEnd();
> > outputLength = encryptorL.MaxRetrievable();
> > encryptorL.Get(m_KatsL, outputLength);
> >
> >
> > My system is : W2k SP4, Visual Studio 6 SP 5, processor pack,
> > cryptolib 5.1
> >
>
> --
> //
> // Peter L. Bell [EMAIL PROTECTED]
> // +61 2 9805 2955
> // Blessed are the Peacemakers, they shall be called Sons of God.
> //
>