PureBasic
PureBasic
Transition from Email.GetSignedByCertChain to Email.LastSignerCert
Provides instructions for replacing deprecated GetSignedByCertChain method calls with LastSignerCert.Chilkat PureBasic Downloads
IncludeFile "CkCert.pb"
IncludeFile "CkCertChain.pb"
IncludeFile "CkEmail.pb"
Procedure ChilkatExample()
success.i = 0
email.i = CkEmail::ckCreate()
If email.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
; ...
; ...
; ------------------------------------------------------------------------
; The GetSignedByCertChain method is deprecated:
certChainObj.i = CkEmail::ckGetSignedByCertChain(email)
If CkEmail::ckLastMethodSuccess(email) = 0
Debug CkEmail::ckLastErrorText(email)
CkEmail::ckDispose(email)
ProcedureReturn
EndIf
; ...
; ...
CkCertChain::ckDispose(certChainObj)
; ------------------------------------------------------------------------
; Do the equivalent using LastSignerCert to get the signing certificate,
; then build the cert chain from the signing certificate object.
signerCert.i = CkCert::ckCreate()
If signerCert.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success = CkEmail::ckLastSignerCert(email,0,signerCert)
If success = 0
Debug CkEmail::ckLastErrorText(email)
CkEmail::ckDispose(email)
CkCert::ckDispose(signerCert)
ProcedureReturn
EndIf
; Get the certificate chain from the signer certificate.
certChain.i = CkCertChain::ckCreate()
If certChain.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success = CkCert::ckBuildCertChain(signerCert,certChain)
If success = 0
Debug CkCert::ckLastErrorText(signerCert)
CkEmail::ckDispose(email)
CkCert::ckDispose(signerCert)
CkCertChain::ckDispose(certChain)
ProcedureReturn
EndIf
CkEmail::ckDispose(email)
CkCert::ckDispose(signerCert)
CkCertChain::ckDispose(certChain)
ProcedureReturn
EndProcedure