Chilkat2-Python
Chilkat2-Python
Convert DSA Public Key DER to PEM
See more DSA Examples
Converts a DSA public key from DER format to PEM.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 DER public key.
success = dsa.FromPublicDerFile("dsa_pub.der")
if (success != True):
print(dsa.LastErrorText)
sys.exit()
# Save the public key to PEM:
pemStr = dsa.ToPublicPem()
success = dsa.SaveText(pemStr,"dsa_pub.pem")
if (success != True):
print(dsa.LastErrorText)
sys.exit()
print("Finished!")