(Visual FoxPro) DSA Public Key PEM to DER Conversion
Converts a DSA public key from PEM format to DER.
LOCAL loDsa
LOCAL lcPemPublicKey
LOCAL lnSuccess
* This example requires the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Dsa')
loDsa = CreateObject('Chilkat.Dsa')
* Load a PEM public key.
lcPemPublicKey = loDsa.LoadText("dsa_pub.pem")
* Import the public key PEM into the DSA object.
lnSuccess = loDsa.FromPublicPem(lcPemPublicKey)
IF (lnSuccess <> 1) THEN
? loDsa.LastErrorText
RELEASE loDsa
CANCEL
ENDIF
* Write it out as a DER file:
lnSuccess = loDsa.ToPublicDerFile("dsa_pub.der")
IF (lnSuccess <> 1) THEN
? loDsa.LastErrorText
RELEASE loDsa
CANCEL
ENDIF
? "Finished!"
RELEASE loDsa
|