GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
OpenXPKI::Crypto::CLI(3) User Contributed Perl Documentation OpenXPKI::Crypto::CLI(3)

OpenXPKI::Crypto::CLI

This module is an ABSTRACT superclass that implements basic handling of calling command line binarys. Note that it can not be instantiated.

The new function creates a new instance of this class. There are the following parameters:
  • SHELL (the location of the binary to use)
  • ENGINE (a reference to an Engine object)
  • TMP (the temporary directory)

This prepares a command array to be executed. The only parameter is COMMAND which must either contain a string or an array reference. The parameter is appended to the shell command.

performs the commands. It throws an exception on error. The behaviour of this function is a little bit difficult. The simplest way is that you use the function without any arguments. This means that you have passed all parameters via the command line parameters and you get the the result via the function get_result or you used an explicit output file.

Example: $cli->execute();

The function supports another way too. Sometimes it is necessary to pass input directly or to read the output directly beause it is critical data which should never be stored on a disk. You can use the parameter PARAMS in this case. You have to specify for each command which you specified via prepare a type and if necessary the data.

Example: $cli->prepare ({COMMAND => ["command1 -params ...", "command2 -params ...", "command3 -params ...", "command4 -params ..."]}); my $params = [ {TYPE => "STDIN", DATA => "the input data"}, {TYPE => "STDOUT"}, {TYPE => "NOTHING"}, {TYPE => "STDOUT"}, ]; my $result = $cli->execute ({PARAMS => $params});

The first command is an example for using STDIN. The specified data will be passed via STDIN to the command. The second command passes the result via STDOUT directly into the code. This means that $result contains the result from the queries two and four. If you need the results seperately the please look into $params->[1]->{STDOUT} and $params->[3]->{STDOUT}. The third query simply enforces normal behaviour via files.

returns the result of the commands which were executed with run_cmd. If there was no output then 1 will be returned.

This function is to be implemented by children classes. It is executed right before the command is executed, so shell environment variables that are relevant for the command can be set here (e.g. OPENSSL_CONF in the OpenSSL case).

This function is to be implemented by the children classes. It gets the STDERR output as a string, which it can parse for errors. Depending on whether there are errors or not, it has to return true or false.

my $cli = OpenXPKI::Crypto::Backend::OpenSSL::CLI->new ({ TMP => "/tmp", SHELL => "/usr/local/ssl/bin/openssl", ENGINE => $engine }); $cli->prepare ({COMMAND => ['x509 -in cert.pem -outform DER -out cert.der']}); $cli->execute (); ## senseless here because the result is in cert.der ## $cli->get_result(); undef $cli; ## now do something with cert.der

OpenXPKI::Crypto::Backend::OpenSSL::CLI - The CLI class for OpenSSL OpenXPKI::Crypto::Tool::SCEP::CLI - The CLI class for openca-scep
2022-05-14 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.