Key sizes supported by 3DES I read about 3DES encryption but I don't understand exactly what the specific meaning of key size is. For example I found that 3DES supports 64, 128, 192, and 256 bits key size. What are all the possible key sizes supported by 3DES?
Is there any function to determine if a key is valid for 3DES or not ?
The triple DES (3DES) block cipher works by essentially running the block through DES three times. Triple DES is also known as "DES EDE" (encrypt-decrypt-encrypt) and under the name given by the standard document: "TDEA". The TDEA algorithm is described in FIPS NIST Special Publication 800-67
 Revision 1 where paragraph 3.2 describes the TDEA Keying Options.



In triple DES you take the block and then:


Send it through DES once with a DES key $k_1$
Send the result of that through DES a second time with a DES key $k_2$ (for this second time we generally run DES backwards; in decrypt rather than encrypt mode, however, that's not important for this question)
Send the result of that through DES a third time with DES key $k_3$.


The result of that is the result of the 3DES block operation.



Now, 3DES comes in two main flavors:


The "2 key" version; in this version, the 3DES key consists of two DES keys; $k_1$ and $k_2$, and we implicitly assume that $k_1 = k_3$.  DES keys are typically represented in 64 bits, and so this version of 3DES has 128 bit keys.
The "3 key" version; in this version, the 3DES key consists of three DES keys; $k_1$, $k_2$ and $k_3$.  Because all three 3 DES keys are explicitly represented, this version of 3DES has 192 bit keys.


The keys are sometimes also referred to as key A, B and C. The key for the 2 key version is then referred to as an ABA key and for the 3 key version as ABC key.

Those are the only standard versions of 3DES; you might have an API which allows 64 bit keys (which likely emulates DES in that case); if it allows 256 bit keys, I have no idea what it would do with them.



In case you're wondering whether DES keys are 56 bits or 64 bits, well, they are considered 56 bits of cryptographic strength (because we can run through all possible DES encryption operations by trying $2^{56}$ different values); however when we represent a key, we typically express it as 8 bytes (or 64 bits).  In that case we essentially ignore the least significant bit of each byte (originally, they were "parity bits" for each byte, however since no one manually enters DES keys anymore, most implementations end up ignoring them instead). That's the way the DES designers did things; most everyone follows tradition.

So sometimes the (triple) DES key lengths are referred to as 56 bit, 112 bit or 168 bits instead of 64, 128 or 192 bits respectively. Usually cryptographic API's still require you to enter 8, 16 or 24 bytes despite of this. AES fortunately does away with all this.