(Swift) Transition from Cert.ExportPublicKey to Cert.GetPublicKey
Provides instructions for replacing deprecated ExportPublicKey method calls with GetPublicKey. Note: This example requires Chilkat v11.0.0 or greater.
func chilkatTest() {
let cert = CkoCert()!
// ------------------------------------------------------------------------
// The ExportPublicKey method is deprecated:
var publickeyObj: CkoPublicKey? = cert.exportPublicKey()
if cert.lastMethodSuccess == false {
print("\(cert.lastErrorText!)")
return
}
// ...
// ...
publickeyObj = nil
// ------------------------------------------------------------------------
// Do the equivalent using GetPublicKey.
// Your application creates a new, empty PublicKey object which is passed
// in the last argument and filled upon success.
let publickeyOut = CkoPublicKey()!
var success: Bool = cert.get(publickeyOut)
if success == false {
print("\(cert.lastErrorText!)")
return
}
}
|