Sign in to follow this  
Followers 0
Fredrik

MMC certificate password paste problem

5 posts in this topic

post-16463-1159908032_thumb.jpg

I am working on a AutoIT3 script that installs certificates using the MMC in W XP PRO SP2.

The usercert.p12 file needs a unique password to become active.

Password is generated for every certificate and is not constant. It changes everytime.

My problem is that from the MMC certificate install window I can not paste the password from clipboard.

I have tried CTRL V in all combinations I could find from the online AutoIT3 documentation.

(CTRL V works then pressed manually on the keyboard)

Right mouse click and then paste is not working, seems disabled by design by Microsoft.

Any ideas please?

PS Is there a reghack to enable right mouse click? DS

Share this post


Link to post
Share on other sites



Hei Fredrik.

You might want to check out ControlSetText, which might work. Something like this :

$sTitle = "Guiden Importera certifikat"
$sPassword = ClipGet()

If WinExists($sTitle) Then ControlSetText($sTitle, "", "Edit1", $sPassword)

Share this post


Link to post
Share on other sites

Tack Helge :lmao:

Copied your code...nothing happens...nothing get sent to the enter password inputfield.

Verified that clipb contains data.

Will read firther ControlSetText function tomorrow, but first some sleep!

Hei Fredrik.

You might want to check out ControlSetText, which might work. Something like this :

$sTitle = "Guiden Importera certifikat"
$sPassword = ClipGet()

If WinExists($sTitle) Then ControlSetText($sTitle, "", "Edit1", $sPassword)

Share this post


Link to post
Share on other sites

This might be something to dig into tomorrow.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I am working on a AutoIT3 script that installs certificates using the MMC in W XP PRO SP2.

Hi Fredrik,

Last week I finished a script which starts the "Certifcate Import Wizard" and imports a certificate. Here is a part of it:

Opt("WinDetectHiddenText", 1)   ; Nescesarry because wizard contains hidden controls
Opt("WinTitleMatchMode", 2) ; Nescesarry for MUI

Const $SleepTime = 200

; Check if import already done
$done = RegRead("HKEY_CURRENT_USER\Software\AKey", "ImportCertificateDone")
If $done <> 1 Then
    $strCertificate = "Your Certfile"
    $strPassword = "YourPassword"
        
    ; Start the Certificate Import Wizard   
    Run("c:\windows\system32\rundll32.exe cryptext.dll,CryptExtAddPFX " & $strCertificaat, "", @SW_HIDE)

    ; Wait until window "Wizard Certificaat importeren" or "Certificate Import Wizard" exists
    WinWait("Certific")

    ; Fill in the Wizard
    ControlFocus("Certific", "", 12324)
    ControlClick("Certific", "", 12324) ; Click Next
    Sleep($SleepTime)
    ControlClick("Certific", "", 12324) ; Click Next
    Sleep($SleepTime)
    ControlSend("Certific", "", 1003, $strPassword) ; Fill in password
    Sleep($SleepTime)
    ControlClick("Certific", "", 12324) ; Click Next
    Sleep($SleepTime)
    ControlClick("Certific", "", 12324) ; Click Next
    Sleep($SleepTime)
    ControlClick("Certific", "", 12325) ; Click Finish
    Sleep($SleepTime)
    ControlClick("Certific", "", 2)     ; Click OK

    RegWrite("HKEY_CURRENT_USER\Software\AKey", "ImportCertificateDone", "REG_DWORD", 1)
EndIf

Hope this helps.

Best regards,

J'tje

Edited by j'tje

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