PDA

View Full Version : read from file commands???



jeeva
01-19-2002, 12:33 AM
I'm using OpenSSL(an application in Linux OS) to setup a Certification Authority (CA). I have setup the CA and I'm also able to create Digital Certificates. Users need to input their details interactively / line by line because OpenSSL is command lines only.
My problem is, I want to create an interface so that users need not input theirs details interactively, all they need to do is just fill in the form and click submit. When submit is clicked, the input data will be written to a text file.
And when another button is clicked, OpenSSL must read from the text file and create the Digital Certificate. How can i do this task? Or please give me any ideas how to replace the command lines with an interface.

starX
01-19-2002, 01:36 AM
If I were to impliment this, I would use perl.

Make your form in html, asking for the fields that you need, and have a perl program grab those parameters, and ten use back-quotes and variable substitution when executing OpenSSL. This should let you bypass writing to the file, and avoid unnecessary overhead while giving your users the simplicity that they'll need.

Hope this helps.

--starX
www.axisoftime.com

Salem
01-19-2002, 01:45 AM
After creating your text file, then something simple like

system( "openssl < file.txt > results.log 2>errors.log" );

should work (providing it reads stdin, and not the terminal directly).

stdout and stderr are redirected to log files for later use.

Or perhaps something like this
http://packages.debian.org/unstable/interpreters/expect.html
would help, if the interaction is particularly complicated.