Sample code for 30+ languages & platforms
Go

Convert DSA Public Key DER to PEM

See more DSA Examples

Converts a DSA public key from DER format to PEM.

Chilkat Go Downloads

Go
    success := false

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

    dsa := chilkat.NewDsa()

    // Load a DER public key.
    success = dsa.FromPublicDerFile("dsa_pub.der")
    if success != true {
        fmt.Println(dsa.LastErrorText())
        dsa.DisposeDsa()
        return
    }

    var pemStr *string = new(string)

    // Save the public key to PEM:
    pemStr = dsa.ToPublicPem()
    success = dsa.SaveText(*pemStr,"dsa_pub.pem")
    if success != true {
        fmt.Println(dsa.LastErrorText())
        dsa.DisposeDsa()
        return
    }

    fmt.Println("Finished!")

    dsa.DisposeDsa()