Chilkat2-Python
Chilkat2-Python
DSA Public Key PEM to DER Conversion
See more DSA Examples
Converts a DSA public key from PEM format to DER.Chilkat Chilkat2-Python Downloads
import sys
import chilkat2
success = False
# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
dsa = chilkat2.Dsa()
# Load a PEM public key.
pemPublicKey = dsa.LoadText("dsa_pub.pem")
# Import the public key PEM into the DSA object.
success = dsa.FromPublicPem(pemPublicKey)
if (success != True):
print(dsa.LastErrorText)
sys.exit()
# Write it out as a DER file:
success = dsa.ToPublicDerFile("dsa_pub.der")
if (success != True):
print(dsa.LastErrorText)
sys.exit()
print("Finished!")