(Chilkat2-Python) 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.
import sys
import chilkat2
cert = chilkat2.Cert()
# ------------------------------------------------------------------------
# The ExportPrivateKey method is deprecated:
# privatekeyObj is a CkPrivateKey
privatekeyObj = cert.ExportPrivateKey()
if (cert.LastMethodSuccess == False):
print(cert.LastErrorText)
sys.exit()
# ...
# ...
# ------------------------------------------------------------------------
# Do the equivalent using GetPrivateKey.
# Your application creates a new, empty PrivateKey object which is passed
# in the last argument and filled upon success.
privatekeyOut = chilkat2.PrivateKey()
success = cert.GetPrivateKey(privatekeyOut)
if (success == False):
print(cert.LastErrorText)
sys.exit()
|