Sample code for 30+ languages & platforms
Visual Basic 6.0 Requires Chilkat v11.0.0+

Transition from Cert.ExportPrivateKey to Cert.GetPrivateKey

Provides instructions for replacing deprecated ExportPrivateKey method calls with GetPrivateKey.

Chilkat Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

Dim cert As New ChilkatCert

'  ------------------------------------------------------------------------
'  The ExportPrivateKey method is deprecated:

Dim privatekeyObj As PrivateKey
Set privatekeyObj = cert.ExportPrivateKey()
If (cert.LastMethodSuccess = 0) Then
    Debug.Print cert.LastErrorText
    Exit Sub
End If

'  ...
'  ...

'  ------------------------------------------------------------------------
'  Do the equivalent using GetPrivateKey.
'  Your application creates a new, empty PrivateKey object which is passed 
'  in the last argument and filled upon success.

Dim privatekeyOut As New PrivateKey
success = cert.GetPrivateKey(privatekeyOut)
If (success = 0) Then
    Debug.Print cert.LastErrorText
    Exit Sub
End If