Sign in to follow this  
Followers 0
VIP

Can't run pvk2pfx PVK/CER to PFX file on AutoIt

9 posts in this topic

#1 ·  Posted (edited)

; ERROR: File not found.
; (Error Code = 0x80070002).

Type to CMD windows or RUN will OK 

Why?

 

#include <File.au3>
Global $vOutputFileName='Trong Cert'
Global $vSaveToDir=@DesktopDir
Global $vPassword='I Love You'
Global $pvk2pfxEXE="C:\Program Files\Sign Tools\pvk2pfx.exe"
If ($vSaveToDir <> "") And ((Not StringInStr($vSaveToDir, "\")) Or (Not StringInStr($vSaveToDir, ":")) Or StringInStr($vSaveToDir, "..\")) Then $vSaveToDir = _PathFull($vSaveToDir, @ScriptDir)
If Not FileExists($vSaveToDir) Then DirCreate($vSaveToDir)
Global $zPath=$vSaveToDir&'\'&$vOutputFileName
If FileExists($zPath & '.pvk') And FileExists($zPath & '.cer') Then
    Local $xCMD = '"' & $pvk2pfxEXE & '" -pvk "' & $zPath & '.pvk" -spc "' & $zPath & '.cer" -pfx "' & $zPath & '.pfx" -pi "' & $vPassword & '"'
    ConsoleWrite($xCMD & @CRLF)
    Run($xCMD, $vSaveToDir)
    ; ERROR: File not found.
    ; (Error Code = 0x80070002).
    ; Run('"'&$xCMD&'"', $vSaveToDir)
    ; Run(@ComSpec & ' /c '&$xCMD, $vSaveToDir)
    ; Run('"'&@ComSpec & '" /c '&$xCMD, $vSaveToDir)
    ;Type to CMD windows or RUN will OK: "C:\Program Files\Sign Tools\pvk2pfx.exe" -pvk "C:\Users\TrOnG\Desktop\OP.pvk" -spc "C:\Users\TrOnG\Desktop\OP.cer" -pfx "C:\Users\TrOnG\Desktop\OP.pfx" -pi "PW"
    ;But can't run with Autoit! Why?
EndIf

 

PVK2PFX.zip

Edited by Trong
add pvk2pfx.exe and PVK/CER demo

Regards,
 

Share this post


Link to post
Share on other sites



Global $zPath=$vSaveToDir&'\'&$vOutputFileName
;$zPath & '.pvk' 
;$zPath & '.cer'
;--> $vSaveToDir = C:\Windows
;--> $vOutputFileName = FileCerName
;---------> C:\Windows\FileCerName.cer 
;---------> C:\Windows\FileCerName.pvk
'

 

 

 

 


Regards,
 

Share this post


Link to post
Share on other sites

Is a "dot" missing from this line ?  (column 29)

Local $xCMD = '"' & $pvk2pfxEXE & '" -pvk "' & $zPath & '.pvk" -spc "' & $zPath & '.cer" -pfx "' & $zPath & '.pfx" -pi "' & $vPassword & '"'
 

Share this post


Link to post
Share on other sites

I do not think so.


Regards,
 

Share this post


Link to post
Share on other sites

Did you download pvk2pfx from Microsoft ?

Share this post


Link to post
Share on other sites

Yes! Windows SDK


Regards,
 

Share this post


Link to post
Share on other sites

You did not use the full path or the correct name for pvk2pfx"DOT"exe.

Review lines 10 and 18.

 

Share this post


Link to post
Share on other sites

I am sure the path is correct, because the program has run.
But the result was not found error message file (probably PVK, .pfx)
The same statement on if typed in the console window works very well.


Regards,
 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0