PowerBuilder
PowerBuilder
Example: Crypt2.EncryptSb method
Demonstrates how to call the EncryptSb method.Chilkat PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Crypt
oleobject loo_BdEncrypted
oleobject loo_SbPlainText
li_Success = 0
loo_Crypt = create oleobject
li_rc = loo_Crypt.ConnectToNewObject("Chilkat.Crypt2")
if li_rc < 0 then
destroy loo_Crypt
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_BdEncrypted = create oleobject
li_rc = loo_BdEncrypted.ConnectToNewObject("Chilkat.BinData")
loo_SbPlainText = create oleobject
li_rc = loo_SbPlainText.ConnectToNewObject("Chilkat.StringBuilder")
loo_SbPlainText.Append("Text to be encrypted")
// ...
// Set the secret key ...
// Set properties such as CryptAlgorithm, CipherMode, PaddingScheme, KeyLength
// Set the IV if needed ...
// ...
loo_Crypt.Charset = "utf-8"
li_Success = loo_Crypt.EncryptSb(loo_SbPlainText,loo_BdEncrypted)
if li_Success = 0 then
Write-Debug loo_Crypt.LastErrorText
destroy loo_Crypt
destroy loo_BdEncrypted
destroy loo_SbPlainText
return
end if
destroy loo_Crypt
destroy loo_BdEncrypted
destroy loo_SbPlainText