PureBasic
PureBasic
Transition from Email.GetEncryptedByCert to Email.LastDecryptCert
Provides instructions for replacing deprecated GetEncryptedByCert method calls with LastDecryptCert.Chilkat PureBasic Downloads
IncludeFile "CkEmail.pb"
IncludeFile "CkCert.pb"
Procedure ChilkatExample()
success.i = 0
email.i = CkEmail::ckCreate()
If email.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
; ...
; ...
; ------------------------------------------------------------------------
; The GetEncryptedByCert method is deprecated:
certObj.i = CkEmail::ckGetEncryptedByCert(email)
If CkEmail::ckLastMethodSuccess(email) = 0
Debug CkEmail::ckLastErrorText(email)
CkEmail::ckDispose(email)
ProcedureReturn
EndIf
; ...
; ...
CkCert::ckDispose(certObj)
; ------------------------------------------------------------------------
; Do the equivalent using LastDecryptCert.
; Your application creates a new, empty Cert object which is passed
; in the last argument and filled upon success.
certOut.i = CkCert::ckCreate()
If certOut.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success = CkEmail::ckLastDecryptCert(email,certOut)
If success = 0
Debug CkEmail::ckLastErrorText(email)
CkEmail::ckDispose(email)
CkCert::ckDispose(certOut)
ProcedureReturn
EndIf
CkEmail::ckDispose(email)
CkCert::ckDispose(certOut)
ProcedureReturn
EndProcedure