Appendix 04: Extending Tools Beyond OpenSSL
Caveat: This does not encourage anyone to roll-out their own cryptogram or cryptographic codes. One may use this as a re-route to codes that are well-reviewed.
Here we used non-cryptographic codes as this is just a tutorial for extending tools via code platforms like C and Python.
As well, we are not addressing the use of openssl C code libraries yet.
C
An option for a command is used to provide additional parameters or arguments to the command or function. For example, command `ls
` list the files in a directory, but to obtain a detailed listing of the files, option `-l
` is used, and `-a
` is used to list all the hidden files. To access the command line parameters in C, the main function is int main (int argc, char *argv[])
.
With that, a program can access every parameter that passed with the option using argv[0], argv[1], ....
, and the number of command line arguments passed by the user can be obtained from argc
.
C provides the following functions to work with the command line arguments:
1. getopt()
2. getopt_long()
3. getopt_long_only()
Note that one option and include a few arguments. Options may or may not take arguments. Example, to compute the area of a rectangle:rectangle -a 5 -b 42
…