Ideally, the keys and IV should be generated randomly. Using the unicode
bytes may not be a good idea becuse it creates repeating sets of zeros in
your key data (in fact, half your key will be zeros for most string
characters used), and that may present vulnerabilities in the expanded key
and even encrypted data itself (clues that would give a potential hacker
insight into what the original key was).
But getting back to the data itself - the IV must always be exactly one
block in size. One block could be different number of bits depending on the
algorithm you use. For most block encryption algorithms, a block is 16 bits
or 32 bits. You can check the BlockSize property on the base algorithm
object.
The key length itself also depends on the algorithm. Most algorithms have at
least a few possible key lengths, which are typically multiples or factors
of the block size (or some relation thereof). You can check the KeySizes
property of the base cipher object for valid sizes of the algorithm you
choose.
On the other hand, if you want to create keys from password strings, rather
than use the strings directly, check out the PasswordDerrivedBytes class. If
you use that class, you can use variably sized input strings. But like I
said, your best bet would be to randomly generate the keys using something
like the RandomNumberGenerator class (both these classes are also in the
system.security.cryptography namespace).
-Rob Teixeira [MVP]