Go
Go
DSA Public Key PEM to DER Conversion
See more DSA Examples
Converts a DSA public key from PEM format to DER.Chilkat Go Downloads
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 PEM public key.
var pemPublicKey *string = new(string)
pemPublicKey = dsa.LoadText("dsa_pub.pem")
// Import the public key PEM into the DSA object.
success = dsa.FromPublicPem(*pemPublicKey)
if success != true {
fmt.Println(dsa.LastErrorText())
dsa.DisposeDsa()
return
}
// Write it out as a DER file:
success = dsa.ToPublicDerFile("dsa_pub.der")
if success != true {
fmt.Println(dsa.LastErrorText())
dsa.DisposeDsa()
return
}
fmt.Println("Finished!")
dsa.DisposeDsa()