Search code examples
phpair

How to respond to password prompts with exec()


I know the title of the question is a bit odd. But I don't know what the thing I am trying to do, is called. So, here it goes --

I'm working on a simple ADOBE AIR app generator,

After generating all the necessary files and signing the application using the file adt

I'm supposed to - generate the actual .air file. Which, after supplying all the parameters asks for password.

How am I supposed to do this? Help!

Packaging an AIR installation file using the AIR Developer Tool (ADT)

PS - If ther's some word to describe what I am doing, please comment :D

[UPDATE]

If one puts

adt -package -storetype pkcs12 -keystore sampleCert.pfx HelloWorld.air HelloWorld-app.xml HelloWorld.html AIRAliases.js

in the command line, it prompts for a password. One can enter it -- when using console.

How are you supposed to provide it when you are doing php exec(); ?


Solution

  • Apparently, you can specify the password on the command line. Look at their docs and do a find on -storepass and -keypass.

    -storepass password1 —The password required to access the keystore. If not specified, ADT prompts for the password.

    -keypass password2 —The password required to access the private key that is used to sign the AIR application. If not specified, ADT prompts for the password.

    You can build the command needed like this:

    <?php
        $command = "/path/to/adt -package -storetype pkcs12 -storepass password -keypass password -keystore /path/to/sampleCert.pfx /path/to/HelloWorld.air /path/to/HelloWorld-app.xml /path/to/HelloWorld.html /path/to/AIRAliases.js";
    
        $output = exec($command);
    ?>
    

    Make sure that you include paths to the adt binary as well as the files needed for the build.