| (Chilkat2-Python) ZATCA Load Certificate and Private Key from PEM FilesDemonstrates how to load a certificate and private key from a pair of PEM files.
 import sys
import chilkat2
# The LoadFromFile method will automatically detect the file format..
cert = chilkat2.Cert()
success = cert.LoadFromFile("qa_data/zatca/cert.pem")
if (success != True):
    print(cert.LastErrorText)
    sys.exit()
print(cert.SubjectCN)
# Load the private key.
privKey = chilkat2.PrivateKey()
success = privKey.LoadPemFile("qa_data/zatca/ec-secp256k1-priv-key.pem")
if (success != True):
    print(privKey.LastErrorText)
    sys.exit()
print("Key Type: " + privKey.KeyType)
# Associate the private key with the certificate.
success = cert.SetPrivateKey(privKey)
if (success != True):
    print(cert.LastErrorText)
    sys.exit()
print("Success.")
 |