Putting It All Together
Now that we have briefly covered the basics, let's take a look at how it all works together. Figures 2 and 3 provide graphical representations of the whole encryption and decryption process.
Figure 2 Graphical representation of RC4 encryption process.
As illustrated in Figure 2, the IV is first created by the access point, and is merged with the pre-shared key to create a secret key. This key is then used by the KSA to create a psuedo random state array, which is then used by the PRGA to create a streaming key that is XORed with the plaintext data and its CRC value. As a result, the encrypted data is created and sent to the receiving party of the WLAN, where it is then unencrypted.
Figure 3 Graphical representation of RC4 decryption process.
In Figure 3, you can see that once the data is received, the IV, which is sent as plaintext appended to the encrypted text, is removed and merged with the pre-shared password to create the same secret key used in the encryption process. This key is then used by the KSA to create a duplicate psuedo random state array value that is used by the PRGA to create the same streaming key used to encrypt the plaintext. This streaming key is XORed with the encrypted text, which results in the creation of the plaintext and CRC value. The CRC value is removed, and a new CRC value is deduced, which is compared to the original CRC value. The data is then either accepted or rejected.