Thread: read from file commands???

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    5

    Unhappy read from file commands???

    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.

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    202
    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

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    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/...rs/expect.html
    would help, if the interaction is particularly complicated.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 04:14 AM
  2. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  3. c script help to read a file & update
    By indy in forum C Programming
    Replies: 8
    Last Post: 12-01-2003, 11:32 AM
  4. How to convert char read from file into string
    By cruxxe in forum C Programming
    Replies: 7
    Last Post: 05-22-2002, 02:09 PM
  5. Hmm....help me take a look at this: File Encryptor
    By heljy in forum C Programming
    Replies: 3
    Last Post: 03-23-2002, 10:57 AM