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. //
