Hi again, Cornell. I'm going to snip down to your last example and question.... then follow that up with my remarks.
> Yes, this worked! Thanks! :) > About the IV i have checked it is not changing, but I will note this for future. > > But I still not understand, when I am doing: > > DES::Decryption desEncryption(key, DES::DEFAULT_KEYLENGTH); > CFB_Mode_ExternalCipher::Encryption cfbEncryption(desEncryption, iv); > > DES::Decryption desDecryption(key, DES::DEFAULT_KEYLENGTH); > CFB_Mode_ExternalCipher::Decryption cfbDecryption(desDecryption, iv); > > cfbEncryption.ProcessData(chiper, plain,bSize); > cfbDecryption.ProcessData(out_plain, chiper,bSize); > it works, when: > DES::Encryption desEncryption(key, DES::DEFAULT_KEYLENGTH); > CFB_Mode_ExternalCipher::Encryption cfbEncryption(desEncryption, iv); > > DES::Encryption desDecryption(key, DES::DEFAULT_KEYLENGTH); > CFB_Mode_ExternalCipher::Decryption cfbDecryption(desDecryption, iv); > > cfbEncryption.ProcessData(chiper, plain,bSize); > cfbDecryption.ProcessData(out_plain, chiper,bSize); > > it allso works, but the chipertext itself is different... > > Which one to use and is this the right way of doing encryption/decription? I hadn't actually tried that, but now that you have I think I see what's going on. Decryption is the inverse operation of encryption, some block ciphers work backwards during decryption compared to encryption, un-doing what encryption did. When you use a decryption object to process plain text you are effectively encrypting it, but I doubt that the security of doing it that way is equivilent to using the encryption object to encrypt. Therefore, it's probably better to use an encryption object to encrypt.... > What is the difference beetween DES::Encryption and DES::Decryption if they both > works... Your questions and example are probably good candidates for the sci.crypt newsgroup, where you can get comments from some real cryptologists. Just don't take everything you read there as gospel, some of them are very good and some just think they are. All of them (almost) are better cryptologists than I am, I'm just an old computer hacker. Rickey
