In modern cryptography, ciphers (crypto algorithms) are publicly available.
You can look at the alogorithm's math and know exactly what it's doing.
However, the math requires a secret key. With DES (and all "symmetric block
ciphers"), the key is used as part of the math to encrypt the data. The very
same key must be used to decrypt it. As you can see, the key is just a
sequence of bytes (it's actually a byte array, not just a single byte).
In .NET, when you create the initial symmetric block cipher object (in this
case, the DES object), it will automatically generate a
cryptographically-strong, random key sequence for you. When you call
CreateEncryptor, if you pass no key, the key in the base DES object is used.
However, as you can see with the method you wrote here, you can pass your
own key (because remember, you must use the same key to decrypt data that
you used to encrypt it in the first place).
As for the IV, it's used in various Feedback modes. If you encrypt straight
plain text one block at a time, and that data had repeating blocks, you
could end up with repeating encrypted blocks, and that could give away clues
to a malicious person looking to crack your encryption. Feedback takes bits
from the previous block and mathematically infuses that data with the next
block as it encrypts. That way, you get even more protection and more
unpreditcable results. However, the first block of data has nothing in front
of it to use as feedback, so the IV acts as a "fake" block of data used to
perform the feedback math on the first block. If you use a feedback mode
(.NET uses some form of feedback by default unless you turn it off), you
must also keep the IV byte sequence used to encrypt the data because you
can't decrypt the data without it. Make sure you keep both the Key and IV
private and safe at all times.
-Rob Teixeira [MVP]
"Tiraman" <ti*****@netvision.net.il> wrote in message
news:OX**************@TK2MSFTNGP12.phx.gbl...
Hi ,
can some one explain me what does it mean those 2 params that i need
to pass the des.CreateEncryptor(rgbKey as byte,rgbIV as byte)
Best Regards ,
Tiraman :-)