Sample code for 30+ languages & platforms
Lianja

DSA Public Key PEM to DER Conversion

See more DSA Examples

Converts a DSA public key from PEM format to DER.

Chilkat Lianja Downloads

Lianja
llSuccess = .F.

// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loDsa = createobject("CkDsa")

// Load a PEM public key.

lcPemPublicKey = loDsa.LoadText("dsa_pub.pem")
// Import the public key PEM into the DSA object.
llSuccess = loDsa.FromPublicPem(lcPemPublicKey)
if (llSuccess <> .T.) then
    ? loDsa.LastErrorText
    release loDsa
    return
endif

// Write it out as a DER file:
llSuccess = loDsa.ToPublicDerFile("dsa_pub.der")
if (llSuccess <> .T.) then
    ? loDsa.LastErrorText
    release loDsa
    return
endif

? "Finished!"


release loDsa