Hello,
I’m working on an AIR 2 application (a packager for air applications into *.exe). One of the options in the application is to check the validity of certificate’s password. I’m using standardOutput method:
private function checkCertPass():void{
file = new File();
file.nativePath = "C:/WINDOWS/system32/"
file = file.resolvePath("cmd.exe");
nativeProcessStartupInfo = new NativeProcessStartupInfo();
var processArgs:Vector.<String> = new Vector.<String>;
processArgs.push(javaPath.text);
processArgs.push("-jar");
processArgs.push(adtPath.text);
processArgs.push("-checkstore");
processArgs.push("-storetype");
processArgs.push("pkcs12");
processArgs.push("-keystore");
processArgs.push(certPath.text);
processArgs.push("-storepass");
processArgs.push(passField.text);
nativeProcessStartupInfo.arguments = processArgs;
nativeProcessStartupInfo.executable = file;
nativeProcess = new NativeProcess();
nativeProcess.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onCertOutputData);
nativeProcess.start(nativeProcessStartupInfo);
}
private function onCertOutputData(event:ProgressEvent):void{
var certResponse:String = new String();
certResponse = nativeProcess.standardOutput.readUTFBytes(nativeProcess.standardOutput.bytesAvailable);
trace(certResponse);
outputField.enabled = true;
outputField.text += certResponse;
if(certResponse.substr(0,5) == "valid"){
trace("Correct password!");
exeField.enabled = true;
nativeProcess.removeEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onCertOutputData);
nativeProcess.exit();
}else{
trace("Incorrect password! Error...");
exeField.enabled = false;
nativeProcess.removeEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onCertOutputData);
nativeProcess.exit();
}
}
but I cannot establish communication i.e. all I receive after performing the code above is:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\\Program Files\\Adobe\\Flex Builder 3>
What is wrong with this code? Why I can’t receive the response?
Thanks in advance,
Nikola