(Tcl) Apple Keychain - Import Pfx
Imports the certficates and private keys contained in .pfx (or .p12) to the Apple Keychain. If intermediate CA certs are contained in the PFX, they are also added to the Keychain if needed.
Note: This example requires Chilkat v10.0.0 or greater.
load ./chilkat.dll
set pfxPath "/Users/chilkat/qa_data/pfx/EXAMPLE.pfx"
set pfxPassword "PASSWORD"
# Load the PFX file.
set cert [new_CkCert]
set success [CkCert_LoadPfxFile $cert $pfxPath $pfxPassword]
if {$success == 0} then {
puts [CkCert_lastErrorText $cert]
delete_CkCert $cert
exit
}
set certStore [new_CkCertStore]
# Note: On MacOS and iOS, the AddCertificate method adds to the Keychain.
# There is no need to "open" the Keychain beforehand.
set success [CkCertStore_AddCertificate $certStore $cert]
if {$success == 0} then {
puts [CkCertStore_lastErrorText $certStore]
delete_CkCert $cert
delete_CkCertStore $certStore
exit
}
puts "Success."
delete_CkCert $cert
delete_CkCertStore $certStore
|