Go
Go
Get Certificate's Public Key
Loads a certificate from PEM and gets the public key.Chilkat Go Downloads
success := false
cert := chilkat.NewCert()
strPem := "-----BEGIN CERTIFICATE----- ..."
success = cert.LoadPem(strPem)
if success == false {
fmt.Println(cert.LastErrorText())
cert.DisposeCert()
return
}
pubKey := chilkat.NewPublicKey()
cert.GetPublicKey(pubKey)
// You can now use the public key object however it is needed,
// and access its various properties and methods..
fmt.Println(*pubKey.GetXml())
cert.DisposeCert()
pubKey.DisposePublicKey()