This homework assignment is an exercise in input sanitization and encryption. The program will read a series of files whose names are specified on the command line. If no file names are given, it will read stdin. Each file contains a series of commands to encrypt or decrypt files. Conceptually, what is happening here is that these files are being run by a privileged program -- it could be the "server" side from the first homework assignment, but in the interests of avoiding interdependency and burdening people who did poorly on the first assignment I am not doing that. That said, input files MUST be considered untrusted; all errors, oddball parameters, must be detected and handled properly. Do not abort an input file on an error on one line; keep going. Each line in the file consist of a command and some arguments. The following commands exist (values shown in <...> are variables; DO NOT actually use < and > in commans). encrypt decrypt password keyfile cd mkdir ALL arguments are either strings of non-whitespace characters or are strings of ANY characters except NUL (a byte equal to zero) enclosed in either single or double quotes. A string that does not begin with a quote mark may contain quote marks within the string. If a quote mark occurs inside a quoted string argument, precede it with a \; precede a \ with a \. Do not do shell-like \ escapes in unquoted strings. Thus, the following arguments are legal: AbcDef.d"f+=32\ "abc def" '123\'456' xy\z "abc'def" but these are illegal: "abc pqr stuv 'jklm" To encrypt a file, use OpenSSL. In particular, invoke the 'enc' subcommand as follows: openssl enc -aes-128-cbc -e -in -out \ -pass file: You MUST invoke the external command; you MUST NOT do the encryption yourself. (See https://www.openssl.org/docs/man1.0.1/apps/enc.html for documentation or see the man page for 'enc' on your VM.) An encrypt or decrypt command uses the argument of the preceding keyfile command. The password command takes a passphrase and converts it to a key stored in a key file; use the PBKDF2 function described in https://tools.ietf.org/html/rfc2898. In other words, to encrypt a file with the passphrase 'Secret', the input would be password Secret s.keyf keyfile s.keyf encrypt but it is legal to have use a pre-existing key file. In other words, a keyfile command need not be preceded by a password command. After converting the passphrase to a key, write it out as a series of hex bytes to the key file. The purpose of the mkdir and cd commands is to aid in construction of test scripts. Your test script should create and populate a directory with suitable input files before running you command (which MUST be called encdec). To make life easier for the TAs when testing, ALL absolute filenames must either refer to existing system files or some file under /tmp. This is NOT something your code should check for; rather, it's a restriction on the test inputs you supply. You MUST NOT use argument-parsing libraries; you MUST parse the strings by hand. In both your code and the test inputs, pay a lot of attention to input sanitization; that's a major purpose of this assignment.