(AutoIt) Transition from Cert.ExportPrivateKey to Cert.GetPrivateKey
Provides instructions for replacing deprecated ExportPrivateKey method calls with GetPrivateKey. Note: This example requires Chilkat v11.0.0 or greater.
$oCert = ObjCreate("Chilkat.Cert")
; ------------------------------------------------------------------------
; The ExportPrivateKey method is deprecated:
Local $oPrivatekeyObj = $oCert.ExportPrivateKey()
If ($oCert.LastMethodSuccess = False) Then
ConsoleWrite($oCert.LastErrorText & @CRLF)
Exit
EndIf
; ...
; ...
; ------------------------------------------------------------------------
; Do the equivalent using GetPrivateKey.
; Your application creates a new, empty PrivateKey object which is passed
; in the last argument and filled upon success.
$oPrivatekeyOut = ObjCreate("Chilkat.PrivateKey")
Local $bSuccess = $oCert.GetPrivateKey($oPrivatekeyOut)
If ($bSuccess = False) Then
ConsoleWrite($oCert.LastErrorText & @CRLF)
Exit
EndIf
|