Swift
Swift
Get Certificate Public Key from PEM
See more Certificates Examples
Demonstrates how to load a PEM file containing a certificate and access the public key.Chilkat Swift Downloads
func chilkatTest() {
var success: Bool = false
let cert = CkoCert()!
success = cert.load(fromFile: "qa_data/pem/my_cert.pem")
if success == false {
print("\(cert.lastErrorText!)")
return
}
let pubkey = CkoPublicKey()!
cert.getPublicKey(pubKey: pubkey)
// Examine the public key as XML..
print("\(pubkey.getXml()!)")
}