Consider the Affine Cipher on the alphabetZ26={A,B, . . . ,Z}with the usual identificationA=0,B=1, . . . ,Z=25, and the encryption function with key(a,b):C=aM+b(mod 26).1. Which of the following keys are valid? and why? (i)(3, 8)(ii)(8, 3)(iii)(5, 0)(iv)(0, 5)(v)(13, 1)2. For each of the above valid keys, determine the decryption function formula. (Please showall your working steps. Without any working steps then you will get 0.)3. Implement the cipher using C++ or Java.The program should be able to do both encryption and decryption. Lowercase charactersa-z will be encrypted/decrypted to lowercase characters. Uppercase characters A-Z will beencrypted/decrypted to uppercase characters. Other characters not in the range (a-z,A-Z)will be unchanged.The program should accept the following parameters: a flag to indicate encryption or de-cryption, a secret key, an input file name, and an output file name. For example:myProgram -key 3 8 -encrypt -in file1.txt -out file2.txtmyProgram -key 3 8 -decrypt -in file2.txt -out file3.txtThe program should be able to detect invalid key and display an error message if it encoun-ters an invalid key. (0.5 marks)4. Test your program (both encryption and decryption) with the keys in question 1 in this part.